#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include
using namespace std;
int main()
{
cv::Rect a(0,0,0,0);
cv::Rect b(4,4,4,4);
cv::Rect inter = a&b; // if intersect is not empty, the rect overlaps
cout<
}
for( int i=0; i
{
for( int j=0; j
{
Rect trect = boxes[i]&boxes[j];
if(trect.width!=0&&trect.height!=0)
{
boxes[i] = boxes[i]|boxes[j];
boxes[j].x=boxes[j].y=boxes[j].width=boxes[j].height=0;
}
}
}
其中必须在声明的时候初始化Rect
hh