1 | initial version |
One thing you could try is running a laplacian filter across the image, regions with higher peaks will be sharper.
However this will not work in regions with little structure, or if your foreground is sharper but less detailed than the background.
the resulting image should be a very rough map of sharpness
This is just a very bad approximation though, I'd love to see a better way to measure local sharpness
also see this Stackoverflow question (deals with global blur only)