OPENCV的 ImageROI 区域不能用两次????

2024-12-04 06:16:34
推荐回答(1个)
回答(1):

我试了下调用两次不会出错,肯定是你代码里面有问题,可以贴出来帮你看看
int main()
{
IplImage* src = cvLoadImage("btvdst.jpg");

cvSetImageROI(src,Rect(0,0,10,10));
cvNamedWindow("src1");
cvShowImage("src1",src);
cvWaitKey(0);
cvResetImageROI(src);

cvSetImageROI(src,Rect(0,0,50,50));
cvNamedWindow("src2");
cvShowImage("src2",src);
cvWaitKey(0);
cvResetImageROI(src);

return 0;
}