Maximas in grayscale image - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Maximas in grayscale image (/thread-28996.html) |
Maximas in grayscale image - yliats - Aug-13-2020 I have a grayscale image (2d matrix), and I want to extract N (defined integer) maximas (marked in red). I don't want them to be clustered all together near each other (the result of directly looking for top N points). I would like these points to be spread all over the image (like shown bellow), with higher density where the values are high, and lower density where the values are low. I am looking for an efficient python algorithm for the task. Thanks. RE: Maximas in grayscale image - scidam - Aug-13-2020 Take a look at scikit-image's peak_local_max function. It has min_distance parameter which regulates density of max-points to be chosen. RE: Maximas in grayscale image - yliats - Aug-13-2020 (Aug-13-2020, 11:59 AM)scidam Wrote: Take a look at scikit-image's peak_local_max function. This worked very nicely! One problem I had was that min_distance was ignored for clusters of pixels that had equal values (all of them were chosen, even though min_distance should have prevented that). This problem was solved by adding noise to the image before using peak_local_max. Thanks. |