[WONTFIX] No fading focus peaking indicators

Started by stevefal, June 08, 2013, 03:54:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

stevefal

I'm not sure if it's intentional, but the focus peaking indicators are strong while changing focus rapidly, but then diminish when you change focus slowly or stop. For me this creates a kind of hysteresis, because the diminishing indicators make me think I've overshot focus, when in fact I may be dead on.

The suggestion is to keep the indicators at the same intensity whether focusing fast or slow, or to at least make this an option.
Steve Falcon

a1ex

The algorithm is just adapting itself to the contrast of the scene. Feel free to suggest a better formula.

stevefal

But this happens when the scene doesn't change. Simple test:

1) Aim down 45 degrees to some carpet.
2) Start at infinity and focus moderately quickly to a few feet.
3) Notice that while changing focus, a dense band of indicators moves down the frame.
4) But when you stop, the strong band fades and might even be barely perceptible.
Steve Falcon

a1ex

Again, please suggest better math. I've spent a lot fine-tuning it and I don't feel like doing it again.

stevefal

Looking at the code, it's beyond my ability to completely understand the theory of operation. If anyone wants to help break it down, I'm happy to collaborate.

My impression is that a damping function is used on the adaptive contrast threshold. When the shot starts entirely out of focus, the threshold has a chance to drop so that when then first focused, a large area has a chance to highlight. Then the damping function catches up again, and the highlighted area becomes small.

If this is correct, maybe a solution is to exclude the currently highlighted areas from the next threshold calculation. Just a hunch.
Steve Falcon

a1ex

Right, the threshold is variable, so only X% of the image is highlighted (and the X is the threshold from menu). There is some damping too when updating this threshold.

stevefal

Quote from: stevefal on June 08, 2013, 05:54:46 PM
If this is correct, maybe a solution is to exclude the currently highlighted areas from the next threshold calculation. Just a hunch.

I see that excluding highlighted areas doesn't make sense - it would cause a lesser focused area to be highlighted in addition to the current area. It would add to the "sparkles" you currently get across the frame when everything is out of focus.
Steve Falcon

a1ex

The underlying problem is that I don't know any absolute measure for focus (everything I've tried is influenced heavily by light levels, contrast and so on). So my workaround was exactly this adaptive threshold, and the issue you posted is a side effect of it.

stevefal

If artificial dampening is being added, I don't get the point of that. Damping in the interaction loop causes hysteresis.

Quote from: a1ex on June 08, 2013, 06:26:54 PM
the threshold is variable, so only X% of the image is highlighted

Not sure X a maximum, minimum or what. I can see that the highlighted area isn't constant.

I suppose the suggestion might be:
- no damping on updating the threshold
- a threshold minimum, to avoid highlighting out-of-focus areas
- a threshold maximum, to ensure that clearly in-focus areas are highlighted, regardless of how much area they cover
- an adaptation algorithm that pushes the threshold down (not past the minimum), to ensure that a minimum of X% of the frame is highlighted.

Steve Falcon

a1ex

To get rid of damping, you would have to build a histogram of the edge detect image and compute the threshold there (requiring two image passes for one frame). The current method computes the threshold iteratively, with very little CPU time, but it takes a bunch of iterations to converge. The damping is there to make the transition a bit nicer, instead of hunting back and forth.

stevefal

That rate of damping might be ok if there was a threshold maximum that allowed clearly in-focus areas to stay highlighted. I can see that dense highlighting of a newly in-focus area is pretty rapid. But the problem is that it is soon un-highlighted in order to satisfy the maximum X area constraint. I think that if half the frame is tack-sharp, it should be highlighted.

I presume that not having a threshold minimum may also contribute to the problem since it allows over-highlighting of unqualified areas before the threshold reconverges. So it adds to the pumping effect and might lead the user to choose a smaller area% than if the threshold was better at filtering out false positives.
Steve Falcon

a1ex

Any idea about how to choose these thresholds? I can't imagine a formula that would cover most situations...

stevefal

I'd think even modest min and max values could be better than what it currently does, assuming the constraint on maximum highlighted area is removed. I mean, currently I can be dialed into something and it gets barely any highlight, but then put on the lens cap and it sparkles across the whole frame. I would rather have high utility in a narrower range of scenarios than lower utility in all scenarios.

This has come up because I have a week of (RAW) video shooting coming up where I won't have my DP6 and its Focus Assist peaking. I ordered a Zacuto Z-Finder loupe and have been trying to stage my configs. I realized when trying ML's focus peaking that I essentially can't trust it due to false positives and the 'fading' issue. In the worst cases it's a crap-shoot, and that's pretty often.

It seems the cause of false positives is the combination of adaptive threshold + minimum highlighted area + no minimum threshold. And the cause of false negatives is adaptive threshold + maximum highlighted area + no maximum threshold.
Steve Falcon