Ask Your Question

Revision history [back]

Sounds ok. (i guess you now cv::countNonZero). If you have many(!) contours and run into speed or accuracy problems, a specialized library like CGAL https://www.cgal.org/ could help you. You compute an approximation of the intersection area whose accuracy depends on the resolution of the image in which you draw the regions. This can be perfectly fine if your regions are nice (no sharp spikes or one-Pixel regions) but if you get problems, an analytical solution (e.g. as implemented in CGAL) could help.