0

I have two similar but quite different approaches to drawing contours. Both contours have similar results but there is a problem. Where a contour draws with approximately 97% accurate and the other contours draw with approximately 86% accurate. But, 86% contains high contrast colors but the one with 97% accurate has less contrasted colors. So, I wanted to remove the extra contour by subtracting. the current result of the two contours is-

enter image description here

Actually, I want to obtain the contours from result1 and addition of these contours to result2. Is there a way to fix the issues? I was thinking if it is possible by subtracting between two contours. But, I couldn't get a solution on Internet for such a problem. I tried by doing the following code-

result2 = result2 - result1    #To obtain the extra contours in result2
result1 = result1 - result2    #To remove the extra contours in result1

But, These doesn't provide the answer and the resulting images are as follows- enter image description here

These contours drawing is followed by the code answered by fmw42

  • 1
    As of now you have drawn the contours directly on the image, instead of that you can use `cv2.drawContours()` on a black background with white color and fill them, then you can subtract the filled contor images to get a new contour image which can then be projected on the original image. – ZdaR Jul 18 '23 at 04:41

0 Answers0