Hello everyone, beginner OpenCV student here:
I am trying to overlay 2 images (or binary images) on each other and I need to find the area of the section where both images intersect.
To do this, my approach is simple:
1 - Find contour of the first image, and then find the area of the contour
2 - Find contour of the second image, and then find the area of the contour
3 - Find the contour of the intersection and then find the area.
area = cv2.contourArea(cnt) line of code typically returns
0.0 as the area and so, I am not able to progress to step 3.
I have searched online and the answers that I keep getting say that the contour is open and because of this, the area is
How do I force the contour to close? or is my approach wrong?
The most important thing for me is to be able to find the area of any contour (from any image I plug in)
Here are my output image(s):
Code and source images can be found here