Open

by damned truths

submit your photo


Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

This question may be somewhat uninformed, as I am certainly no expert on the notions involved, so please bear with me :)

In the context of manipulating synthetic bokeh in post-processing,

settling for using gaussian blur as a substitute for actual bokeh (I know that they are distinct things, see e.g. "What's the difference between Bokeh and Gaussian Blur?", but for the matter on topic we'll forget about this),

can't we just use, e.g., contrast detection, and maybe other methods, to learn where bokeh already exists in a given image, and then intensify this bokeh? (Instead of having the photographer/user define where to artificially put a guassian blur.)


I can very well imagine a technique like this to work. You could, sequentially:

  1. Use contrast detection, and, for example, if bokeh circles exist, simply measure their diameter, to create a "heat map" of bokeh in the image.
  2. Then you could put a gaussian blur (or other kind of artificial bokeh) over the image, weighted by the heat map of step 1.
  3. Now you have an image where the bokeh is not created from scratch, but simply intensified from already existing bokeh.

(And if worried that in-focus areas bay be blurred, you could also, say, put gaussian blur where the heat map values are above e.g. .2 (in a scale of 0 to 1), and possibly even apply "the opposite thing", say local contrast, below .2)

share|improve this question
    
How do you tell what was actually an edge and what is in focus and not an edge though? CDAF only works because it can tell when contrast reaches the peak. –  AJ Henderson Jul 3 at 18:45
    
(Well I have no definite technical answer, as I don't know these things in-depth, but I can very well imagine post can deduce quite good what is in focus and what not. Maybe "contrast detection" is toot technical a word for what I imagine is possible. Say, for example, you use the fact that bokeh "smears" things together, so you measure how similar neighbouring patches of pixels are—not neccessarily looking for contrast edges..) –  Kelley van Evert Jul 4 at 12:27
    
In focus vs out of focus is the same thing though, you can find the highest contrast points and you know that those are in-focus edges, but if things are out of focus, it is far, far more difficult to tell if they were edges or not. As Matt Grum mentions, there are some more complicated ways to try and guess, but they aren't super reliable because it involves very complex image processing and/or assuming that some things are edges that might not be. –  AJ Henderson Jul 4 at 16:41

2 Answers 2

This is known in the field of image processing as "depth from defocus". What you are suggesting is possible to a degree, the results will never be the same as you'd get (especially if you use Gaussian blur rather than lens blur!) but it will simulate a certain amount of

There are various techniques to achieve depth from defocus, it's a bit more involved than estimating contrast, however I believe the latest version of Photoshop CC has a bokeh masking feature. I don't know if you get different levels or if it is just an in-focus/out-of-focus (black and white) mask.

share|improve this answer

Alien Skin had a Bokeh plugin for Photoshop that handled the subtle fogging of defocussed hi-lights - photoshop CS6/CC now has what looks like the same function and system in Field Blur - the key is to have some scattered highlight points in your image

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.