How to find whether the position is a Peak position in a kernel window?

asked 2017-09-14 09:40:26 -0500

Karthikeyan gravatar image

I am searching for an OpenCV function that replicates the function of peak_local_max in scikit-image. What this function does is, It compares the values over a window of mentioned size whether the anchor point value is greater than or equal to the maximum of other positions or not. If the case satisfies, it considers it as a local peak.

Is there a OpenCV function that could do this job? I know about minmaxLoc and minmaxIdx but it calculates for global frame which I am not interested. I am thinking of taking the filter2D function as reference and create my own functionality to do this. On the parallel side I want your suggestions to go about this problem?

Any help could be really appreciated. Thanks in advance!

edit retag flag offensive close merge delete


may this post will help you

LBerger gravatar imageLBerger ( 2017-09-14 09:59:19 -0500 )edit

I mentioned in the question itself, I know about the minMaxLoc but that is not what I expected. Thanks for your help

Karthikeyan gravatar imageKarthikeyan ( 2017-09-15 04:33:04 -0500 )edit

" but it calculates for global frame" no there is a mask. You have to adjust mask relative to the window size you need

LBerger gravatar imageLBerger ( 2017-09-15 04:41:22 -0500 )edit

Got your point! Firstly I don't wan to find the maximum in the window. I want to find the peak whether the anchor point contains the maximum value or not. Secondly My window size is 5x5. For the image of 1280x720 how efficient is this thing?

Karthikeyan gravatar imageKarthikeyan ( 2017-09-15 05:09:46 -0500 )edit

anchor ? filter2D is convolution so anchor is everywhere. I don't understand. A small example is welcome

LBerger gravatar imageLBerger ( 2017-09-15 05:56:59 -0500 )edit