遮罩/将指定 ROI 之外的区域归零
我正在开发一个使用 OpenCV 进行模板匹配的项目,并且我想限制图像上的搜索区域。图像是从相机连续捕获的。
有没有办法对定义的 ROI 之外的图像进行归零/屏蔽,以便模板匹配过程可以针对剩余区域,更快、更准确?
I'm working on a project using OpenCV on template matching, and I want to limit the search region on an image. Image is captured continuously from a camera.
Is there any way to Zero / mask out image outside ROI defined, so that template matching process can be specific on remaining region, faster and accurate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看一下 cvSetImageROI 函数。
Take a look at the cvSetImageROI function.
您可以使用 cvSetImageROI 来设置感兴趣的区域。模板匹配函数仅使用您设置的 ROI(并忽略其之外的任何内容)
You use cvSetImageROI to set the region of interest. The template matching functions use only the ROI you set (and ignore whatever is outside it)