Blurred (focussed) region could be arbitrary shape (not just rectangle)
Simple input/output example:
(is valid any algorithm, command, software, ...)
Thank you!
Blurred (focussed) region could be arbitrary shape (not just rectangle)
Simple input/output example:
(is valid any algorithm, command, software, ...)
Thank you!
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:
High pass filter your image. (Edge detection, absolute differences between neighboring pixels, Laplace or local variances, ...) (Matlab)
Smooth and apply threshold.
Apply pre-knowledge about imaging optics if existing. Example would be knowing that the focus must be round and in in the center, ...