cv::Rect BoundingBox;
int IntersectionArea = 0;
//insert Min-Max X,Y to create the BoundingBox
for (every y inside boundingbox)
for (every x inside boundingbox)
if (PointPolygonTest(x,y,Contour1) && PointPolygonTest(x,y,Contour2))
IntersectionArea++;
3 回答
在两个图像中使用
CV_FILLED
绘制形状并使用AND . 面积是:CountNonZero(bitwise_and(ShapeAImage,ShapeBImage))
.最简单的代码编写方法如下:
你可以找到交叉点多边形wth Clipper library
那么calc area of this polygon