Issue with macro stacking and Photoshop

I've never tried macro stacking before so after visiting another forum thread: http://www.canonrumors.com/forum/index.php?topic=20914.0, I decided to try it myself with software I already have - Photoshop CC. I did multiple test images today but few of the processed stacks suffer from some very bad blending on edges.

Example images show the result from Photoshop (Auto align and auto blend stacked images) and three source layers for the incorrectly blended area. What am I doing wrong and what I need to do to avoid this issue?

Thanks in advance for any advice.
 

Attachments

  • Focus_stacking_issue.jpg
    Focus_stacking_issue.jpg
    323.2 KB · Views: 330
  • Focus_stacking_layer1.jpg
    Focus_stacking_layer1.jpg
    166.6 KB · Views: 320
  • Focus_stacking_layer2.jpg
    Focus_stacking_layer2.jpg
    185.7 KB · Views: 319
  • Focus_stacking_layer3.jpg
    Focus_stacking_layer3.jpg
    287.4 KB · Views: 313
Congratulations (sort of) for finding one of the problems with focus stacking on your very first try. Like many other things, there is no fix for all situations. But once you know what you are dealing with the you have some options for mitigation. This was written with the idea of having inline images. That option does not seem to be supported :p

So what happened?

Your samples are labelled 1 to 3 and they are closest to and furthest away respectively from the lens. When the edges in layer 1 are sharp, the lower petal in layer 3 is out of focus. When layer 3 is in focus, layer 1 is blurry. But in addition to a general blur, out of focus portions of layer 1 have also “bloomed” to a larger size than in layer 1. So now we have a problem. Whenever layer 3 is sharp, some portion will always be blocked by the bloom in layer 1. Stacking algorithms have trouble making up data along the edge in a convincing manner.

Do others have this problem?
My lab has a dedicated Leica imaging system that has features to minimize the problem but still includes some tools for a manual work around.

The first image exhibits some of the same issues in your sample. It was created from a stack of 23 images each with a 0.1180mm Dof. The Leica system uses telecentric lenses to reduce magnification changes as a function of distance. The single most important issue for better results is to leave the focus constant (tape it off) and move the camera on a macro rail.

The next two images are at the beginning and end of the stack. The white dashed lines indicate the in-focus region. Notice the blooming circled in orange.

The Leica system also calculates and displays a depth map and confidence map so you can see what is guiding the algorithm.

If necessary, you can fix problems manually by drawing a mask in filling in problem areas from regions of good focus.

By properly using all the tools, excellent results can be obtained for really small objects.

What does this mean for Photoshop?
Your post did not ask “How can I get my lab system to make better images?”, but I thought it might be interesting to see that even $50,000 systems sometimes struggle with the same issue you discovered.
Now that you know the cause, it becomes easier to make a plan that works for you. When the subject size is constant or growing as a function of object distance, then the automated stacking algorithms work pretty well. When the subject geometry is getting smaller as a function of distance, then blooming can become an issue. To minimize these effects:

1) Look for an angle that minimizes Z-height variation.
2) Optimize image count to the smallest number by critically selecting focus planes.
3) Use depth of field to reduce image count requirements.
4) Fix the focus and instead move the camera for each image.
5) Stack in Photoshop with blurry images on top and reveal sharper layers below with erase tool.


I’ve done manual Photoshop editing to create stacked images and generally the technique involves erasing part of an image to reveal a sharper image from the layer below. When the two images above are stacked, the resulting image looks good.

Focus stacking is a great tool, but the source images need to be controlled for good results.
Hope that helps.
 

Attachments

  • 10.jpg
    10.jpg
    171.3 KB · Views: 321
  • 6.jpg
    6.jpg
    205.4 KB · Views: 310
  • 7.jpg
    7.jpg
    19 KB · Views: 1,290
  • 4.jpg
    4.jpg
    24 KB · Views: 1,306
  • 3.jpg
    3.jpg
    41.6 KB · Views: 1,295
  • 1.jpg
    1.jpg
    31 KB · Views: 1,307
  • 2.jpg
    2.jpg
    40.3 KB · Views: 1,338
  • 5.jpg
    5.jpg
    93 KB · Views: 1,195
Upvote 0
Feb 15, 2015
667
10
I tried stacking in PS CS5.5 and it was worse than useless. Apparently not much has changed. Most serious stackers use either ZereneStacker or HeliconFocus, which are stand-alone, perpetual license software packages that actually work. I prefer Zerene a bit, but both have pros and cons. If you go to the Photomicrography forum, nobody is using PS for stacking. Some use combine-z; have not tried that myself.

I do a lot of orchid photography, like your Phalenopsis hybrid. What others have mentioned already I second: keep focus fixed, move camera. It sort of works with a manual rail, but if you go >1:1, then you may want to get the Cognysis Stackshot motorized, computer controlled focusing rail. Next you need to calculate depth of field (google it and you can find formulas). Interestingly, it only depends upon magnification and f-stop, not on focal length of lens. I use 0.03 mm for circle of confusion and am happy with results. Usually, you stack rather open (all open or 1-2 stops down) and use many steps. Recommended step size is 70% of DOF, so that program can find overlap of sharp areas.

I disagree with recommendation 3 of Spinguy. Shoot open to get resolution, and increase number of steps. This becomes much more important at >1:1 because of diffraction. I can clearly see differences between f/2.8 and f/4 on the MPE 65. f/2.8 is markedly sharper already at 1:1; gets much more pronounced at higher mag. My short stacks are around 20 frames, average is 60, high end is around 200.

I also disagree with recommendation 1 of Spineguy. Shoot the angle that gives you the image you want, then adjust start and end point of your stack, shoot as many frames as required.

I generally use the Pmax algorithm of Zerene, rarely have to substack/recursive stack in a few select cases. Dmax is often preferred by the insect shooters. Zerene also permits you to edit images and to touch up images from specific focal planes. I hardly ever have to do that, only spot the dirt specs on the sensor in Affinity Photo. Zerene takes images from any imaging system, either jpegs or tifs (no CR2, which HeliconFocus accepts). I always shoot CR2, then batch correct and export from DxO as tifs.

Re microscope manufacturer software, I have a Zeiss system with Zeiss ZenBlue and the z-stacking module for it. It works for up to about 6 frames, but after that Zerene produces WAY better results. I suspect the same also applies to the Leica app. For microscopy DOF is wavelength x square root of (1 - NA squared), divided by NA squared. NA is usually given for compound objectives, but it took a while to get info for stereomicroscope. If you have motorized focus and a module to control stacks, find out what assumptions are used to control steps. Zeiss uses 0.2 DOF for step-size, which is complete overkill. Tried from 0.1 to 1 DOF in 0.1 steps, plus 1.4 and 2 DOF, and only >1.0 DOF I could detect any adverse effects. So 0.7 DOF is quite safe.

On stereomicroscope, you also should align the optical axis to the z-axis (they are off by ~7 degrees for stereo vision) to avoid lateral movement of image when focusing up and down. For higher end stereomicroscopes there are correction systems (objective slider for Zeiss Discovery series). Most stacking programs have alignment function built in, but best to start of with the best alignment that can be mechanically achieved.

If you are interested, I wrote an article on photographing small orchid flowers (pleurothallids, Oberonia, Appendicula, etc.) in Orchid Digest. Has more details on stacking and a table with DOF at various mags and f-stops. PM me and I'll send you a link to the pdf.
 
Upvote 0
From a technical standpoint I agree with all of Zeidora’s comments. But my starting point was Ladislav’s opening comment “I've never tried macro stacking before”. Someone without specialized lenses, processing software and computer driven motion control might have more success limiting frames during acquisition. I’ve found that manually acquiring even just 10 frames is pretty taxing - much less than the 20 that Zeidora calls a “short stack”. I also agree that diffraction becomes a huge issue at higher magnifications. Blending 3 or 4 frames manually with Photoshop is a reasonable way to get started and will quickly reveal why “serious stackers” quickly move to other methods. BTW, when I was still shooting without motion control, I used the RRS B-150 Macro Focusing Rail. It’s a solid product that still finds use. http://www.reallyrightstuff.com/B150-B-Macro-focusing-rail
 
Upvote 0
Thanks Spineguy and Zeidora for the explanation.

I will try to process source images with trial version of Helicon just to see if that makes a difference. I don't expect to buy the product anytime soon unless I find more interest in taking focus stack. Right now it was really only about trying something new and I only invested some £20 to buy a cheap rail http://www.amazon.co.uk/gp/product/B009SJ7UWU. It is enough for me to find out if that is something I'm interested in or not before I invest anything more.
 
Upvote 0
Jan 1, 2013
1,920
39
Ladislav,
I hope you haven't purchased the device yet. I got it and it was not even close to what I expected at that price.
-r

Ladislav said:
Thanks Spineguy and Zeidora for the explanation.

I will try to process source images with trial version of Helicon just to see if that makes a difference. I don't expect to buy the product anytime soon unless I find more interest in taking focus stack. Right now it was really only about trying something new and I only invested some £20 to buy a cheap rail http://www.amazon.co.uk/gp/product/B009SJ7UWU. It is enough for me to find out if that is something I'm interested in or not before I invest anything more.
 
Upvote 0
Jul 28, 2015
3,368
570
lion rock said:
Ladislav,
I hope you haven't purchased the device yet. I got it and it was not even close to what I expected at that price.
-r

I am not sure what you expected for £20 but getting the level of control over rail movement requires an accuracy of engineering to reduce the amount of play that I would be (very pleasantly) surprised to get at that price. I have three of the same model (one bought and lost, its replacement and one donated) and I suspect they are all re-badged names from the same supplier, and all have different amounts of play in the ratchet. I guess if you get one at the good end of manufacture quality you will think it is great value for money, if it at the other end of quality control you will think it is pants.

The reason I got one of those is that even the Manfrotto own model was getting criticism for creep or play, and decided it was either spend £20 or £100+ so like Ladislav I decided to get one to see how I got on with it.
Generally I fix the camera and change the point of focus as I find it easier but am still experimenting.
 
Upvote 0

YuengLinger

Print the ones you love.
CR Pro
Dec 20, 2012
3,751
2,269
USA
Spineguy said:
From a technical standpoint I agree with all of Zeidora’s comments. But my starting point was Ladislav’s opening comment “I've never tried macro stacking before”. Someone without specialized lenses, processing software and computer driven motion control might have more success limiting frames during acquisition. I’ve found that manually acquiring even just 10 frames is pretty taxing - much less than the 20 that Zeidora calls a “short stack”. I also agree that diffraction becomes a huge issue at higher magnifications. Blending 3 or 4 frames manually with Photoshop is a reasonable way to get started and will quickly reveal why “serious stackers” quickly move to other methods. BTW, when I was still shooting without motion control, I used the RRS B-150 Macro Focusing Rail. It’s a solid product that still finds use. http://www.reallyrightstuff.com/B150-B-Macro-focusing-rail

Thanks big time, Spineguy. A friend of mine was doing quite a bit of small-product photography and found PS CS6 to be sufficient--and as good for his needs as Helicon. Your tips are right on target for those of us who want to bring more depth of field to close-ups and macros that don't get into the sub-atomic zone!

You took a lot of your time to give an excellent, brief tutorial on what can be very fun while giving many more options for our macro photography.

Welcome, welcome, welcome to CR!
 
Upvote 0
Mar 25, 2011
16,848
1,835
I have not done any stacking for 10 years, I only did a little in order to play with it. At the time, I used Breeze DSLR pro and a focus changing software that let me program for the number of images and the step size. It then used freeware combineZM. I was not working at any sort of a competence level, so its interesting to read your comments.

I just looked at the folder on my pc, the combineZM files are dated 2007 so its only been 8 or 9 years!

I bought a German Made focus rail locally from Craigslist, still new in its box, but
I had to adjust it to be pretty stiff to remove the play. Getting a good one would be a good investment for someone actually planning to do serious macro work.

How well does changing focus in small steps work compared to moving the camera?

I just checked, and the section is still there for DSLR Remote Pro.

It may be better than fooling with photoshop.

http://www.breezesys.com/DSLRRemotePro/focus_stacking.htm
 
Upvote 0
Feb 15, 2015
667
10
Re adjusting focus vs. adjusting camera position, at lower magnifications (say 1:5 and less) adjusting focus works fine. From about 1:2 upwards, I would only move camera. In between, ho hum. Have not investigated it methodically.

Attached is a image of an orchid (Mormolyca ringens) where I changed focus. This is at about 1:10-15, guestimated. Shot with Zeiss MP 100 at f/8 with about 20 frames.

Second image was shot with MPE 65 on StackShot, flowers about 4 mm in size (Malaxis perakensis). maybe 30 frames

Third image was shot on Stereomicroscope (Zeiss SteREO Discover V20 with planapo 1.5x, motorized focus), flowers are about 5 mm (Dienia ophrydis). maybe 30 frames.
 

Attachments

  • 13131257_1601127713537275_742886239041702317_o.jpg
    13131257_1601127713537275_742886239041702317_o.jpg
    49.3 KB · Views: 781
  • 12140752_1587495228233857_2139790889947828919_n.jpg
    12140752_1587495228233857_2139790889947828919_n.jpg
    22.7 KB · Views: 802
  • 13094188_1597806697202710_2847992419702524313_n.jpg
    13094188_1597806697202710_2847992419702524313_n.jpg
    50.3 KB · Views: 271
Upvote 0
Mar 25, 2011
16,848
1,835
Zeidora said:
Re adjusting focus vs. adjusting camera position, at lower magnifications (say 1:5 and less) adjusting focus works fine. From about 1:2 upwards, I would only move camera. In between, ho hum. Have not investigated it methodically.

Yes, I was not working with macro sized images. It was just out of curiosity that I tried it.
 
Upvote 0
Feb 15, 2015
667
10
YuengLinger said:
Focus breathing, or changing of the image size as focus changes, is a problem with my ef 100mm 2.8 for sure, and that is one of the challenges software faces.

I've often wondered if using a rail rather than manual focus works better to reduce or even overcome focus breathing?

Same as above. The higher the magnification, the greater the problem. At <1:10, no problem, at >1:2 noticeable problem, with MPE 65, forget about changing focus.
Software does take it into account to a certain degree. The out of focus areas are always larger, and by selecting only the in-focus portions, you still get sharp images. There is the issue of distortion, and unless you tell the software what the distortion is, you cannot account for it. I don't know of any software that can calibrated for distortion. At <1:10, distortion is not quite as much of an issue than at higher mag (see above).
 
Upvote 0