10

2 つのポリゴンの輪郭があります (cv::Point2d のベクトルとして)。

それらの間の交差面積を計算したい

入手しやすい方法は?

どうもありがとうございました!

ロン

4

3 に答える 3

12

2 つの画像で図形を描画しCV_FILLED、AND します。エリアは次のとおり CountNonZero(bitwise_and(ShapeAImage,ShapeBImage))です。

于 2013-07-23T13:58:31.813 に答える
3

コーディングする最も簡単な方法は次のようになります。

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++;
于 2013-07-23T13:04:07.997 に答える
3

Clipperライブラリで交差ポリゴンを見つけることができます

//create clipper polygons from your points
c.AddPolygons(subj, ptSubject);
c.AddPolygons(clip, ptClip);
c.Execute(ctIntersection, solution, pftNonZero, pftNonZero);

次に、このポリゴンの面積を計算します

于 2013-07-23T13:46:14.533 に答える