0

Blurred (focussed) region could be arbitrary shape (not just rectangle)

Simple input/output example:

enter image description here

(is valid any algorithm, command, software, ...)

Thank you!

josejuan
  • 9,338
  • 24
  • 31

1 Answers1

0

The variance is much higher in focused regions because blurring acts as a spatial low-pass filter.

But if the object shows no variance (uniform object like wall or a sky) you are completely lost and do not see any differences at all between the blurred and focused regions.

Therefore your question cannot be answered for every kind of image. It's impossible.

What I would do:

  1. High pass filter your image. (Edge detection, absolute differences between neighboring pixels, Laplace or local variances, ...) (Matlab)

  2. Smooth and apply threshold.

  3. Apply pre-knowledge about imaging optics if existing. Example would be knowing that the focus must be round and in in the center, ...

Community
  • 1
  • 1
NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104
  • [Focus Measure](http://www.mathworks.com/matlabcentral/fileexchange/27314-focus-measure) might be helpful. – NoDataDumpNoContribution Jun 20 '14 at 13:00
  • Using a edge detector should work better but I'm looking for a more sophisticated solution (better solutions), accepted anyway ;) – josejuan Jun 20 '14 at 18:58
  • @josejuan If you know something about your optics (dependence of defocus/blurring effect on distance from center of focused area for example) and if you can assume something reasonable about the object (letters, people, trees, matches, ...) then you just have to find the parameters of the imaging system that together with the assumption of the object best fits to the image observed. Hope you find something better. – NoDataDumpNoContribution Jun 20 '14 at 19:30