遮罩/归零区域超出指定的ROI [英] Mask / Zero out area outside specified ROI

查看:85
本文介绍了遮罩/归零区域超出指定的ROI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用在模板匹​​配上使用OpenCV的项目,并且我想限制图像上的搜索区域.从相机连续捕获图像.

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.

是否有任何方法可以将定义在ROI之外的图像归零/遮罩,以便模板匹配过程可以针对剩余区域进行特定设置,从而更快,更准确?

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?

推荐答案

看看

void cvSetImageROI(IplImage* image, CvRect rect)

void cvSetImageROI(IplImage* image, CvRect rect)

为给定的矩形设置图像感兴趣区域(ROI). 参数:

Sets an image Region Of Interest (ROI) for a given rectangle. Parameters:

  • image –指向图像标题的指针
  • rect – ROI矩形

如果原始图像的ROI为NULL,并且 直肠不是整个形象, 分配了ROI结构.

If the original image ROI was NULL and the rect is not the whole image, the ROI structure is allocated.

大多数OpenCV函数都支持使用 ROI并处理图像矩形 作为单独的图像.例如,全部 像素坐标的计数 从左上角(或左下角)开始 ROI的一角,不是原始的 图片.

Most OpenCV functions support the use of ROI and treat the image rectangle as a separate image. For example, all of the pixel coordinates are counted from the top-left (or bottom-left) corner of the ROI, not the original image.

这篇关于遮罩/归零区域超出指定的ROI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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