Does an application exist where I can input an image and then the application indicates what parts of the image are in focus? I imagine it as a sort of post-process focus peaking.
|
|
The simple recipe is to convolve with a Laplacian of Gaussian kernel (3x3, with 8 in the middle surrounded by -1 and take the abs(result)) . After this you get some artifacts if it is a jpeg image, and out of focus borders that have a high intensity difference will also "ping". The result you can threshold to detect the strongest edges and remove teh artifacts. Let the threshold be generous, letting a few fake specks through. Then median filter the image and you get a cleaner result. For the example below I used Image View Plus More: 1. original 2. abs(LoG convolution ) 3. threshold 4. median filter There are more advanced approaches using Gabor filters in fourier domain, and using the gaussian pyramid approach. Halcon (which is very expensive) has some examples with these methods.
|
|||
|
|
|
For example you can use Photoshop (or any other program which has a High Pass filter) for that. In Photoshop:
You will see (if you have good eyes) the focused edges having a different gray tone than the background. At the step 3 you can play a little bit with the Radius to obtain different results. The method works in common cases but there are some situations in which an out-of-focus object might appear as 'focused'. But these cases are usually rare. |
|||
|
|
