DMap settings

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

Moderators: rjlittlefield, ChrisR, Chris S., Pau

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

DMap settings

Post by ChrisR »

I have noticed that Dmap can preserve detail better than PMax in some cases, but I have trouble with the Estimation and Smoothing settings.
Rik, is it possible to use the numbers to predict when this sort of thing will happen? The frame on the right is the DMap output.

Image

I'm not sure about what stage this "stuff" pops up, but it can take (my pc!)an hour or more to run a stack so it would be worth avoiding.

Increasing the settings, purely by trial and error, gets rid of it, but what do they mean? Estimation of what? Smoothing of what?

I like that way that contrast is not boosted in DMap, and it handles specular highlights better, but I've hardly ever produced a usable image with it. Always there are the "contours" round focused parts on top of other focused parts at differernt depth, which are no good unless the image is to be used small enough, and there are too many to retouch.

Usually with Pmax I find I turn down the colours and contrast in Photoshop.

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

Post by rjlittlefield »

I think it's impossible to give an exact answer to your questions, so let me try giving one that is short and fairly accurate.

Recommendation Part 1: Make a copy of your image and shrink it in Photoshop until it appears really crisp when viewed at 100%. Note the shrink factor. Then in ZS, set Estimation Radius = 2 * Shrink Factor. Always set Smoothing Radius = 0.5 * Estimation Radius. Example: Suppose your image is 4K pixels wide, but you have to shrink it to 1K pixels wide before it looks crisp at 100%. Then Shrink Factor = 4 and you should try Estimation Radius = 8.

Recommendation Part 2: When ZS asks you to "Set contrast threshold", start with the slider full left (no added black in the preview window), then slide it right until all or most of the "blotches" in smooth areas are turned to black in the preview. See HERE for example.

Now, a bit of explanation.

At each pixel position, DMap estimates the best focused frame by analyzing pixel values in a small neighborhood around that position. The size of the neighborhood is specified by Estimation Radius.

If the neighborhood is too big, then it may include a substantial range of depths on the subject. In this case, some sort of average will be used. That average tends to be weighted in favor of image contrast, which causes loss-of-detail halos in low contrast areas that happen to be adjacent to high contrast areas at a different depth.

If the neighborhood is too small and does not contain much detail, then the estimate becomes vulnerable to pixel noise. In this case, the analysis is liable to produce a "depth" that is nonsense, essentially a random number. This causes blotches that are not focused and are often brighter or darker than the focused frame would be. The "contrast threshold" specifies which estimates will be ignored because they are too likely to be wrong. Places where the estimate is ignored get their depths filled in by interpolation from surrounding areas.

The goal of Recommendation Part 1 is to set a neighborhood size that is big enough to find most real detail, while being small enough to avoid most loss-of-detail halos.

The goal of Recommendation Part 2 is to set the best possible threshold, where "best possible" means the one that corresponds closest to human judgement.

The biggest limitation in DMap (and similar algorithms in other software) is that a single neighborhood size is used for all areas of the image. This essentially assumes (pretends) that all areas of the image contain identifiable detail at the same scale. For some images this is true enough, for others it is not.

In the example you show, it looks to me that the green leaves have strong detail at a fairly small scale, while the red petals and of course the OOF background do not. This is why you get blotches in the petals and background when the slider is set full left (Percentile: 0.0).

With DMap, when a single neighborhood size is not workable for an entire image, then at present your only recourse is to make two or more DMap runs using different radii, and combine those results by manual retouching.

The key difference between DMap and PMax is that PMax operates simultaneously at a wide range of neighborhood sizes, ranging from a couple of pixels wide to hundreds of pixels. This avoids some difficulties and introduces others, as you've noted.

It would be nice to have yet another stacking method that would combine all the good characteristics while throwing away all the bad. Not there yet, sorry!

--Rik

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

Thanks Rik. That will take some more reading to digest.

The "blocks" on the petal were there before the second part of the Dmap processing. Is it wrong to increase the extimation and smooting settings to get rid of it?
I'm puzzled immediately though by "before it looks crisp at 100%". Perhaps I'm being thik but I'm not sure what that means!
Here's the pic, PMax, fiddled with for 5 minutes. Not particularly sharp, due to wobbles I think. Inexpert fiddling. Focus banding, poor lighting, oh well...
here

ChrisR
Site Admin
Posts: 8668
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

There isn't much detail in that petal, but whatever I do, Dmap can't get all that there is. I've tried with Estimation Radius in a few steps from 1 to 40. High numbers are only better, as far as I can see, across most of the image.
The petal becomes an area of red fog.
Is that what's expected?

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

Post by rjlittlefield »

ChrisR wrote:I'm puzzled immediately though by "before it looks crisp at 100%". Perhaps I'm being thik but I'm not sure what that means!
Consider again the example I gave: "Suppose your image is 4K pixels wide, but you have to shrink it to 1K pixels wide before it looks crisp at 100%."

What I mean is that at 4K it looks blurred at 100% -- no detail at the pixel level. At 2K it still looks blurred at 100% -- still no detail at the pixel level. Finally at 1K it looks crisp at 100% -- now there is significant change in pixel value from one pixel to the next.

That part of the recommendation has the goal of getting a good Estimation Radius on the first attempt. If you've tried a range of settings already, then the recommendation is not relevant.
There isn't much detail in that petal, but whatever I do, Dmap can't get all that there is. I've tried with Estimation Radius in a few steps from 1 to 40. High numbers are only better, as far as I can see, across most of the image.
The petal becomes an area of red fog.
Is that what's expected?
The way I'm interpreting your words, this is a problem that I have not seen before.

The blotchiness shown on right side in your first post is typical appearance when DMap can't find actual detail and is making nearly random decisions based on pixel noise, compression artifacts, or other non-subject content. Each pixel value in the image, at that stage of the method, comes directly from whichever frame was judged as being best focused at each pixel position. The blotchiness is caused by random choice of frames, combined with variation in brightness between frames.

I'm a bit surprised to see this level of blotchiness in a petal, especially in combination with what appears to be subject related structure in the blotchiness. Differences in brightness from frame to frame are common in background areas, where real background gets overlaid with OOF foreground. But it's not so common in foreground, which is what I interpret the petal to be.

If this were my stack, I'd go looking for some frames in the middle that got underexposed for whatever reason. I'm not confident there are some -- it's just a possibility to look for. If there are some, then one possible scenario is that underexposed frames produce blotchiness, which prompts us as users to increase the contrast threshold for DMap, which discards all the useful data, which ends up giving mush because incorrect depths get filled into the "missing" regions. A PMax, in this case, would still look fine because PMax is intrinsically robust against brightness differences.

Another issue that comes to mind... Are the source frames JPEG or TIFF? Sometimes (not often) JPEG will introduce enough compression artifacts to mess up stacking in smooth regions, even though the artifacts are not obvious to us humans.

And one more thought... DMap makes decisions based on grayscale brightness, not directly on RGB triples. If the visible detail consists mostly of hue changes, not brightness, then our eyes might see it while DMap would miss it. I doubt that's the case, but again this might be useful background information sometime.

Bottom line is that I'm struggling for ideas. If you can't figure it out, perhaps you can send the stack to support@zerenesystems.com as discussed previously?
Here's the pic, PMax...
Now it's my turn to be puzzled. In the PMax image, I can't find the same leaf and petal that I see in the crop you posted initially. Am I just missing it, or is this a different composition?

--Rik

Post Reply Previous topicNext topic