Two wrongs can make a right

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

Lou Jost
Posts: 5944
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Two wrongs can make a right

Post by Lou Jost »

A week or two ago there was some discussion on the forum about using layer blending modes to improve images. Here I want to show one way to do it.

Here are 100% crops of three images. The first and second are very ugly DMap and PMax stacks of the same wafer images. They show low contrast and lots of CA and look awful. However in Photoshop, if you make a background layer out of the PMax result and a new layer on top of it out of the DMap result, and choose Multiply in the Blending Mode menu of the Layer window, almost all of the ugliness goes away. The right-hand image is what I get from that blended image after I apply a little exposure and contrast adjusting and sharpening and selective color darkening in ACR.

This works really well for wafers and other subjects where color fidelity is not so important. Luminosity blending mode does something similar but is more subtle. These techniques are especially effective when the CA of the two source images is in different places; when that happens, blending them using these modes (Multiply or Luminosity) removes the CA completely.

By the way, the dust is there on purpose; those are my patented "astigmatism test particles". The blending techniques I've just described remove the astigmatism of a PMax image almost completely if the DMap image does not have much astigmatism.
Sandwich.jpg

rjlittlefield
Site Admin
Posts: 23561
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: Two wrongs can make a right

Post by rjlittlefield »

Lou, this is a spectacular improvement!

But on a quick test, I cannot reproduce your result by using DMap and PMax extracted from the posted image. I'm still left with a lot of CA around the big dust spots.

I suppose this somehow disappears in the "selective color darkening", but I'm not sure what that means.

Any possibility that you could make available the DMap and PMax image separately, and the exact procedure that you used to create the final?

--Rik

Beatsy
Posts: 2105
Joined: Fri Jul 05, 2013 3:10 am
Location: Malvern, UK

Re: Two wrongs can make a right

Post by Beatsy »

That's an enormous improvement Lou. Another technique that could be useful in certain situations - and an interesting new (novel) starting point for further experimentation too. Thanks.

Lou Jost
Posts: 5944
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Re: Two wrongs can make a right

Post by Lou Jost »

Rik, the other things I did were also important. The blending itself is useful for getting rid of astigmatism and removing CA that differs between the source images. The rest of the process is (in ACR):

1. Drop the Highlights slider to a lowish vallue
2. Increase expsoure to compensate.
3. Dehaze. Careful not to alter the colors too much.
4. Add a bit more Contrast if needed.
5. CA can be removed using the Split Toning (adjusting Luminance, not Hue or Saturation) and/or the Defringe tools in the Lens Correction tab.
5. Sharpen with the slider set to Details, set Amount to a relatively high number, move the Radius slider very carefully to find the value that gives the best result (this is a very sensitive adjustment for some images, but not very critical for others), move the Amount slider back down a bit to a reasonable number, and then very lightly move the Details slider a very small distance to the right (if you go too far it looks oversharpened).

Somewhere in there I also used the Vignetting filter in Photoshop (NOT the horrible Vignetting slider in Lens Correction in ACR).

I think that is everything I did. These things can also be applied directly to the DMap image to give a similar result without using Blending modes at all. But that would leave all of the defringing work to the Split Toning and Defringing tools, neither of whcih are ideal (they affect colors globally, not just in the fringes). Blending modes get rid of the CA selectively, when the location of the CA differs between DMap and PMax images, and also gets rid of astigmatism if that shows up in the PMax but not the DMap image. The two images repair each other!

Sometimes a better way to remove CA if possible is to make an Action using the Photoshop Lens Corrections filter (not the much clumsier and less selective Lens Corrections tab in ACR) and applying it to all the individual non-stacked images before stacking. I was too short of time to do that on this simple test image.

I can send the full images via email to you.

Beatsy, thanks, blending modes are very interesting and under-used! Lots to explore.

RDolz
Posts: 96
Joined: Mon Aug 28, 2017 9:32 am
Location: Valencia (Spain)

Re: Two wrongs can make a right

Post by RDolz »

Lou: Spectacular !! =D> =D> Thank you very much for sharing !!, .... yes, I have a lot to learn
Ramón Dolz

MarkSturtevant
Posts: 1946
Joined: Sat Nov 21, 2015 6:52 pm
Location: Michigan, U.S.A.
Contact:

Re: Two wrongs can make a right

Post by MarkSturtevant »

That is interesting. I reminds me also of a trick for greatly reducing sensor noise that is commonly used in astrophotography, and its also done for still life scenes. The method involves taking several separate pictures of exactly the same scene (so the camera and subject are fixed in place). Then in photoshop these are opened as several layers, and then the layers are averaged together. Because the pixels that are noise will appear in different spots in the different pictures, they get averaged out, and what is left are pixels that recorded information of the scene. Obviously this should have applications for macrophotography of still subjects as well.

A fairly automated procedure for this in photoshop is here: https://www.youtube.com/watch?v=B2hLCTQJC90. Lacking that, one can do a similar procedure more by hand, and its not too difficult.
Mark Sturtevant
Dept. of Still Waters

Lou Jost
Posts: 5944
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Re: Two wrongs can make a right

Post by Lou Jost »

Does anyone know how to make a Photoshop action that takes four or five photos and averages them, and then takes the next four or five photos and averages them, etc, for all the photos in an entire folder?

Mark, yes, this blending mode is a kind of nonlinear averaging, combining images with complementary defects which heal each other when multiplied.

I should explain what the "Multiply" blending mode does. If we scale all RGB values to a scale of 0 to 1, "Multiply" (as you would expect from the name) just multiplies each value for each RGB channel and assigns that number to the pixel. So it preserves blacks and whites (0*0+0, 1*1=1), but anything times 0 is zero, so anything that is black in either of the two inages will be black in the blended images. This is why astigmatism goes away if it is only in the PMax image and not in the DMap image (and this is frequently the case). And it is why CA against a black background in either image will be eliminated if the other image has CA in a slightly different position (again, this is often the case for at least some of the CA). And in general the multiplication of values increases contrast because multiplying two numbers less than one makes an even smaller number, while the whites are unchanged; all the other values are therefors stretched downward.

Chris S.
Site Admin
Posts: 4042
Joined: Sun Apr 05, 2009 9:55 pm
Location: Ohio, USA

Re: Two wrongs can make a right

Post by Chris S. »

Lou Jost wrote:
Thu Apr 22, 2021 3:37 pm
Does anyone know how to make a Photoshop action that takes four or five photos and averages them, and then takes the next four or five photos and averages them, etc, for all the photos in an entire folder?
Lou,

I don't know of such a Photoshop action, but vaguely recall, long ago, writing Photoshop scripts, rather than actions. These scripts referenced file names within a folder. These Photoshop scripts seemed to have greater freedom than Photoshop actions to do things like scan folders. So my guess would be that a Photoshop script, rather than Photoshop action, would be more likely to do what you're looking for.

Here is an overview of Photoshop scripting; Photoshop Scripting.

And here is a a script that purports to do image averaging in Photoshop (I have not tried it, and make no claims for its efficacy.) Script: https://www.verdantvista.scot/Photoshop ... ing-Script

---Chris S.

Lou Jost
Posts: 5944
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Re: Two wrongs can make a right

Post by Lou Jost »

Wow Chris, thank you!! I remember looking at that years ago, when I was first getting started, and it was very intimidating. But I know Visual Basic and that might give me control over some of those objects...I had forgotten about that...

The example deals with one-time averaging, though; the trick is to apply this successively to blocks of N images in a large stack of s*N images. That's the part I can't figure out.

Online
JKT
Posts: 420
Joined: Fri Oct 28, 2011 9:29 am
Location: Finland
Contact:

Re: Two wrongs can make a right

Post by JKT »

Then there's ImageMagick, which is made for scripting. Combine that with VB, PowerShell or even good old CMD and this should be relatively simple. You do the file selection outside ImageMagick and just pass the filenames as parameters in the call.

Lou Jost
Posts: 5944
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Re: Two wrongs can make a right

Post by Lou Jost »

Thanks for the tip, JKT.

Post Reply Previous topicNext topic