# What are the possible ways to find spots with most concentrated contrast on an image?

I'm thinking of pixelize + threshold, but I need a more formalized way of finding the darkest spots on the photo, with tweakable parameters.
Something I can think of is the parts with lowest spatial frequency and least luminous pixels together, i.e. the spots with darkest pixels spread over a largest area (on average) should win but small black dots should be considered too, with some sort of adaptive weighing.
desired result; left image transformed to right image:

UPD: The required result is, in fact, a metric. Which should be a ratio of locally cumulated contrast over a known area.
Local points of negligibly small size should not count, no matter how contrast they are; bigger areas with mediocre contrast features should win [because their cumulative luminosity power is higher]. The closest thing I can think of is a 2D probability distribution function; kernelized, smoothed out, spatially-oriented.

• it's not quite clear what you're looking for. Maybe adding a picture and clearly marking in it what these "spots" are would help. Commented Oct 20, 2020 at 20:29
• @MarcusMüller i need result similar to the image in the description, but strictly parameterized and comparable; what i do not need: edge detection / median luminosity calculation; what i do need: finding and quantifying areas with highest contrast Commented Oct 20, 2020 at 20:52
• I'm confused: your question says you want the biggest contiguous dark area. That's something with a very low contrast. Could you maybe explain what kind of contrast you mean? Commented Oct 20, 2020 at 21:04
• @MarcusMüller i need areas with highest contrast over a largest area possible ratio; i.e. contrast of 50% over 100 pixels radius counts equally same as contrast of 100% over 3 pixels wide area; i need contrast 'kernels', as i call them; perhaps some spectral methods will do Commented Oct 20, 2020 at 21:09
• hence the "kind of"; please, really, add this to your question's text, it's crucial! Commented Oct 20, 2020 at 21:24