I want to find local maxima of each '3X3' sized Window. So, How do we find that local maxima of each 3X3 sized Window in an image in OpenCV ?
See Question&Answers more detail:osI want to find local maxima of each '3X3' sized Window. So, How do we find that local maxima of each 3X3 sized Window in an image in OpenCV ?
See Question&Answers more detail:osYou can use morphological operation dilate:
Mat img; // your input image that you should fill with values
Mat maxims(img.size(), img.type()); // container for all local maximums
dilate(img, maxims, Mat());
As a result each pixel of 'maxims' is maximum of appropriate 3x3 window in 'img'. Read more about morphological operation (dilatation, erosion, close, open, etc...) on Wikipedia or somewhere else.