mjkzz wrote:It seems even X and Y shift alignment can result some purple edge (please see my reply to ray_parkhurst) compared to image without alignment, that is the puzzling part.
It's hard to tell for sure just by looking at these images, but here is my best guess.
First some background...
With wide-aperture lenses, there is an issue that we have come to call "utilized aperture". What it means is that due to directional reflections from the subject, only part of the lens sees a subject feature. If this part of the lens happens to be off-center, then effectively the feature is being seen from the side, not straight down the optical axis. As a result, when the lens moves straight along the optical axis to step focus, the feature appears to move -- we might say it "virtually moves" -- a small distance laterally in addition to changing focus.
With very diffuse lighting and a subject that has complex geometry, this sort of virtual movement is what causes the
"squirmy" effect with moth scales that I have described elsewhere.
But with more directional lighting and a subject that has simpler geometry, the virtual movements can be very much the same for every shiny feature on the subject. In this case it can be difficult to distinguish between a physical movement of the stage and virtual movement of all the bright features moving as a group.
My best guess is that with this subject and this illumination, we're seeing virtual movement of all the bright spots as a group, due to the utilized aperture effect. Meanwhile the dark lines and light surround are not moving, or are virtually moving in a different direction due to their different geometry in depth. In this scenario, the alignment computation is apparently locking onto the small bright spots and correcting for their virtual movement, which then causes the less well defined lines to shift, which in turn exposes the CA that is present in the source images.
Yes, this is a complicated and subtle problem. It is intrinsic to the way the light works. I do not know how to avoid it in general.
In some cases, using DMap instead of PMax will help, because DMap never merges information from more than two frames at any one pixel position. With high mag wide aperture objectives, there are persistent reports that best results are obtained by using DMap in combination with very small focus steps, maybe 1/4 or less of what you would think based on the nominal DOF.
But this is not foolproof. One difficulty with your grid target is that the features we want to lock onto for determining focus are quite sparse, so it is not obvious how to set the contrast threshold. Working with your images, I get best results with a slider setting of 95%, at which point almost the entire image is "black in preview", with just the edges of the lines and the white spots showing. I am used to setting such thresholds and I understand why they work, but to less experienced users it would look crazy. Another complicating factor is that when images are
not shifted, either physically or virtually, then PMax is likely to reduce color fringing in the output, compared to what is actually present in the input.
As an example, compare the following crops:
PMax output, without shifting:
Source image IMG_0026
DMap output, without shifting:
As you can see, the DMap output is faithful to the source image, and both of them have a lot more color fringing than the PMax output.
But then compare to the PMax output with shifting:
To my eye this is a little sharper than the PMax without shifting, and has less color fringing than the original source, but more than the PMax without shifting.
So which one is best? Beats me -- choice of the consumer, I guess. Among the images above, there is no solution that gives the combination of sharpness and lack of CA that we would really like -- and which is not present in the input!
It's worth noting that the color fringing being shown here is
lateral CA, not longitudinal CA that varies with focus. It quite possible that the best solution would be to preprocess the source images to remove lateral CA, then stack PMax with alignment.
That's a bit too much trouble for me to try right now. Instead, I show the result of postprocessing the output to remove lateral CA, using Photoshop's filter for Lens Correction with Fix Red/Cyan Fringe setting to -60 (determined by watching the image at 200% while moving the slider).
PMax with shifting, post-processed to remove lateral CA.
I hope this helps. Thanks for the exercise.
--Rik