Locate peaks in grayscale image

asked 2015-04-23 22:59:03 -0500

Barry gravatar image

Hello, I have a grayscale 2-D image that is produced as the result of a template match. The image is grayscale and contains about a dozen maximum points (showing each location where the template matched). I would like to identify each maximum point and include the area around that point down to about 80% of the of the maximum point's value. Outside these regions I will set the values to zero.

What I will end up with is a bunch of irregularly shaped grayscale dots within a black field. Each dot's Centerpoint is some maximum value. What the actual value is will be different for each dot.

The first approach would be to use a threshold to zero, but the value at the maximum points could be 255, 133, or even something as low as 51. An arbitrary threshold might get rid of low value, but important, maximums.

Can anyone suggest a way of accomplishing this or point me in the direction I should be looking?

Thanks, Barry.

edit retag flag offensive close merge delete


An example image could help. Have you tried some sort of dynamic / adaptive thresholding?

boaz001 gravatar imageboaz001 ( 2015-04-24 03:06:26 -0500 )edit

Thanks for your reply. I find that using the SimpleBlobDetector pretty much does what I want if I set the MinArea and MaxArea parameters. Before I set these parameters I was missing a few of the lower value peaks. They were not being detected as blobs. Another way to look at what I am trying to do – picture a grayscale image as a two-dimensional mountain range with the gray intensity shown as mountain peaks popping up. I would like to lower a large pane of glass until it touches one of the peaks, mark this point, get rid of the mountain beneath it, then continue lowering the glass until the next peak is touched. Mark this point, get rid of the mountain below it, and repeat until all the peaks are detected.

Barry gravatar imageBarry ( 2015-04-24 17:47:14 -0500 )edit