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.