在图像中寻找局部最大值 [英] Finding Local Maxima in an Image

查看:81
本文介绍了在图像中寻找局部最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到每个3X3"大小的窗口的局部最大值.那么,我们如何在 OpenCV 中找到图像中每个 3X3 大小的窗口的局部最大值?

推荐答案

可以使用形态学操作 扩张:

You 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());

因此,'maxims' 的每个像素都是 'img' 中适当的 3x3 窗口的最大值.在维基百科或其他地方阅读更多关于形态学操作(膨胀、侵蚀、闭合、打开等...)的信息.

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.

这篇关于在图像中寻找局部最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆