Haralick's primal topograhic sketch is the answer to that. Check-out the peak section of :
Haralick R., et al. - The Topographic Primal
If you also look at the notation and Hessian parts, you will grasp how to implement peak finding (local-max) as a convolution operator.
Regarding your comments below:
Of course you get multiple peaks, but this is also the case when you convolve with a simple 3x3 mask. However, the technique is more robust because:
- If you do the classification from the eigenvalues/vectors of the structure tensor, you will be reasonably robust against the noise.
- Of course you get multiple peaks, but this is also the case when you convolve with a simple 3x3 mask. However, such peaks can be avoided using appropriate thresholds. If such threhsolds are not available, dynamic thresholding might be an option.
- This is better than checking all the neighbors mainly for your question, because every operation can be done through OpenCV routines. And also because you will have a much much better result.
- I would like to direct you to Haralick's original paper, which is fun to read.
Harlick R., et al. - The Use of the Facet Model and the Topographic
Primal Sketch in Image
and also check out other important works such as:
Boulanger P., Cohen P. - Stable Estimation of a Topographic Primal
Sketch for Range Image
Consider using the Facet model for approximating the local image structures with polynomials. Read Haralick's paper for more information.
Finally, for more information on the structure tensor, you can checkout the wiki pages and here:
Goldlückel B. - The Structure Tensor of an