0

我正在将 OpenCV 用于我的视频特征跟踪项目。我需要创建一个遮罩,它是一帧与下一帧之间的差异。我知道要做到这一点,我们可以使用 cv.absdiff 函数。问题是我希望掩码只包含帧的指定小部分的差异,即不是整个图像。我不知道该怎么做。

4

1 回答 1

1
// define regions of interest in images
Rect roiRect1(x1, y1, roiWidth, roiHeight);
Rect roiRect2(x2, y2, roiWidth, roiHeight);

// create images of regions of interest. no copy is performed, this is just new pointers to existing data
Mat roiImage1(frame1, roiRect1);
Mat roiImage2(frame2, roiRect2);

// do whatever you want with those images
......
于 2013-10-20T13:39:29.743 回答