Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intersection area of 2 polygons in openCV

I have the contours of 2 polygons (as vector of cv::Point2d).

I would like to calculate the area of intersection between them

What is the easiest way to get it?

Thank you very much!

Ron

like image 253
Ron Gross Avatar asked Jul 23 '13 12:07

Ron Gross


1 Answers

You can find intersection polygon wth Clipper library

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

then calc area of this polygon

like image 101
MBo Avatar answered Sep 20 '22 07:09

MBo