Jump to content
UltravioletPhotography

Dust Removal in Zerene Stacker


bvf

Recommended Posts

This information has been posted in the bowels of another post, but is repeated here for ease of reference.

 

The problem of sensor dust becomes acute as magnification in macrophotography increases above magnifications of about 2:1. Dust is particularly problematic when using focus stacking software because this results in even otherwise unnoticeable spots becoming highly visible as streaks.

 

For users of Zerene stacking software there is a new utility (at the time of writing available only in the latest downloadable beta version) which is very effective in overcoming this dust problem. These notes, using extensive input from Zerene, explain how to use the utility, and in particular how to create the dust masks that the utility needs.

 

1. At the Zerene End

 

You will need Beta Version T2020-06-01-1033-beta or later or a full release version dated later than July 2020 to get this capability.

 

To turn the feature on go to Options > Preferences > Preprocessing and check the Use dust and defects mask box. Select the file that contains the mask (see below). Make sure that either "In-Fill before aligning" or "Explicitly propagate good pixels" is checked: the former is probably better in most cases.

 

To use this feature you will need a Pro licence for Zerene. With Student and Consumer licences you can trial the feature for 30 days.

 

NOTE: if you upgrade to a Pro version, you may get out-of-memory errors when using the dust removal utility. If this happens, go to Options > Preferences > Memory Usage and increase the amount of memory currently allocated to Zerene. If the value is 4,000 then it is definitely too low. A setting of 5,000 seems to work OK but you may wish to build in a greater margin.

 

2. Make a Grey Background Image (GBI)

 

You will need an image which contains your current dust spots. You could use one of the images that you are going to stack, but it is easier if you make an image (referred to as GBI here) with a plain grey background using the same lens, aperture, and bellows/tube extension (if relevant) that will be used for your real images.

 

IMPORTANT: make sure the GBI is the same image type (e.g. JPEG) as the images you are going to stack. If you create, for example, a TIFF version of the GBI from RAW output from your camera, it will probably have slightly different dimensions (in pixel count) from a JPEG output by your camera.

 

IMPORTANT: Zerene cannot detect image orientation, so the orientation of the GBI (and the mask created from it) must be the same as that of the images being stacked. If, for example, you made the GBI in landscape but your stacking images are in portrait then you will have to rotate either the GBI or the stacking images.

 

3. Making a Dust Mask manually

 

This description uses GIMP, but a similar process must be possible using Photoshop.

  • · Ensure that Preferences > Image Import & Export > Promote imported images to floating point precision is off.
  • · Load the GBI into GIMP.
  • · Create a 2nd layer, pure white
  • · Move the GBI to the top and set Opacity to about 90%.
  • · Activate the lower, GBI layer.
  • · Select the Pencil tool and set a size big enough to cover typical dust spots – 20 pixels worked well for me. Set pencil colour to black.
  • · Zoom the display to 200% or more.
  • · Scroll around the image and click on the centre of each dust spot. This should create a black disk under the dust spot on the lower white layer. By having the GBI layer Opacity at 90%, you can faintly see this black disk.
  • · For larger blemishes:

o Increase the Pencil size, or

o Keep the left mouse button down and paint over the blemish.
  • · When you have done all the dust spots, delete the top, GBI layer.
  • · Flatten the image (Right-click on the white layer in the Layers panel).
  • · Save the lower white layer as your manual mask. IMPORTANT: save this as an uncompressed TIFF.

4. Making a Dust Mask automatically

 

There are 2 stages to this:

  1. Capture the dust spots
     
     
  2. Expand the Dust Spots

4.1 Capture the Dust Spots

 

There will be multiple ways of achieving this, but this approach uses GIMP and is easy.

  • · Load the GBI into GIMP
  • · Set sharpening to maximum ((Filters>Enhance>Sharpen (Unsharp mask)).
  • · Set image to Greyscale (Image>Mode>Grayscale)
  • · Set Contrast to maximum (Colors>Brightness-Contrast)
  • · Set Brightness to the minimum that does not cause noise dots to appear (best to view the image at 200-400% so you can see this.)
  • · You should now have a pure white field with pure black dust spots. Save this interim mask as a TIFF file.

4.2 Expand the Dust Spots

 

This ensures that the dust spots in the mask are:

 

1.
slightly larger than the dust spots on the target images

2.
are solid. (In macrophotography, the dust spots may be concentric light and dark rings because of diffraction.)

 

4.2.1 Using Photoshop Elements.

  • · Load the GBI into Photoshop.
  • · Select the Magic Wand tool.
  • · Make sure the tool property Contiguous is unchecked.
  • · Enlarge the image ( Ctrl + ) so that the dots are a good working size on the screen.
  • · Click on any black dot. This will select all black dots in the image. (If you look carefully, you can see shimmering outlines).
  • · Go to Select>Modify>Contract and set Contract By to 2 pixels (you can play around with this setting later if you want). This causes very small dots to be ignored.
  • · Go to Select>Modify>Expand and set Expand By to 5 pixels (you can play around with this setting later if you want). This enlarges the dust spots that have not been ignored.
  • · Go to Edit>Fill Selection and select Contents Use = Black and Opacity = 100%.
  • · Save the resulting image as a TIFF – this is your Dust Mask.

4.2.2 Using GIMP

  • · Load the GBI into GIMP (or just continue from stage 4.1).
  • · Select the Select By Colour Tool (not the Magic Wand / Fuzzy Select Tool).
  • · Enlarge the image to perhaps 400% so that the dots are a good working size on the screen.
  • · Click on any black dot. This will select all black dots in the image. (If you look carefully, you can see shimmering outlines).
  • · Go to Select>Shrink and set Shrink selection by to 2 pixels (you can play around with this setting later if you want). This causes very small dots to be ignored.
  • · Go to Select>Grow and set Crow selection by to 5 pixels (you can play around with this setting later if you want). This enlarges the dust spots that have not been ignored.
  • · Go to Edit>Fill with FG Color (assuming your foreground colour is set to black. If it isn't then use BG colour if that is black, or use the Colour Picker to set colour to black.)
  • · Click on Select>Invert
  • · Go to Edit>Fill with BG Color (assuming your background colour is set to white. If it isn't then use FG colour if that is white, or use the Colour Picker to set colour to white.)
  • · Save the resulting image as a TIFF – this is your Dust Mask.

5. Updating the Dust Mask

 

The Dust Mask file can be retained for use in subsequent sessions. However, there are likely to be new dust spots which cause new dust streaks to appear. You can update the Dust Mask manually by:

  • · Loading the Dust Mask into GIMP.
  • · Load one of your images into GIMP as a top layer, and set opacity to 90%.
  • · Expand the view to 200%
  • · Set the Pencil Tool as described above for manual masks
  • · Find the dust spot(s) that are causing the streak and click on them.
  • · Delete the top layer and save the lower layer as a TIFF as your updated Dust Mask.

Link to comment
Editor's Note: Bernard, thank you for reposting your Dust Mask instructions. I am going to put this into the Tutorials section. I think it will be useful to many who are learning and/or working with Zerene Stacker.
Link to comment

If many of us are using Zerene Stacker we might persuade Rik, the developer of Zerene to include the Dust mask generation into the program.

He might do that eventually, but if I understand Bernhard correctly it is not very high in his to do list.

Link to comment

What Rik actually said was "I wish that I could say something like "Ah, there's a new beta..." But I can't. The capabilities that you're asking for are certainly months away, if I ever do figure them out." We also discussed the desirability of Zerene being able to automatically detect the orientation of image and mask and/or check that they're the same size, but that is "quite a lot of work so it probably won't happen soon".

 

But there's no harm in people letting him know how valuable an auto mask generation tool would be, to help him prioritise his developments. But to be honest, now that I've done it a few times the process described above is pretty easy and only takes a few minutes.

Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...