【发布时间】:2017-08-25 18:43:54
【问题描述】:
我正在尝试在检测到的面部上方创建一个 ROI,以放置如图所示的帽子:请点击此处:ROI created above face to place a hat
我已确保创建的 ROI 在图像的范围内。它看起来像这样: // 创建一个投资回报率 // 其中face是检测到的人脸ROI
if (0<=face.x && 0<=face.x-face.width*0.08<=image.cols && 0<=face.x+face.width+face.width*0.08<=image.cols
&& 0<=face.y && 0<=face.y-face.height*0.28<=image.rows)
{
Mat ROI_hat = image(Rect(abs(face.x-face.width*0.08),abs(face.y-face.height*0.28),abs(face.x+face.width+face.width*0.08),abs(face.y)));
rectangle(image,Point(abs(face.x-face.width*0.08),abs(face.y-face.height*0.28)),Point(abs(face.x+face.width+face.width*0.08),abs(face.y)),Scalar(255, 0, 0), 1, 4);
cout<<"Within the bounds of Image"<<endl;
}
else{
cout<<" Out of bounds of Image "<<endl;
}
没有负值,并且对于每一帧,它都表示投资回报率在界限内。但我仍然得到断言错误:
OpenCV 错误:断言失败 (0
谁能告诉我哪里出错了?
【问题讨论】:
-
错误信息是什么?
-
OpenCV 错误:断言失败 (0
-
那么您的投资回报率在图像之外...再次检查您的条件
-
你能详细说明一下吗?我听不懂你想说什么
-
部分 ROI 超出图像边界