2 つのポリゴンの輪郭があります (cv::Point2d のベクトルとして)。
それらの間の交差面積を計算したい
入手しやすい方法は?
どうもありがとうございました!
ロン
2 つの画像で図形を描画しCV_FILLED
、AND します。エリアは次のとおり CountNonZero(bitwise_and(ShapeAImage,ShapeBImage))
です。
コーディングする最も簡単な方法は次のようになります。
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++;
Clipperライブラリで交差ポリゴンを見つけることができます
//create clipper polygons from your points
c.AddPolygons(subj, ptSubject);
c.AddPolygons(clip, ptClip);
c.Execute(ctIntersection, solution, pftNonZero, pftNonZero);