Search code examples
pythonopencvintersectionarea

Find the unique area from the overlapping rectangles in python


I am trying to find the unique area from multiple bounded box generated to find the screen capture by the products in python

enter image description here


Solution

  • You can try threshold the image by colors first (using either HSV threshold, or RGB).

    Then having several binary images, you can use Contour Approximation (number 4 on the page) feature, using Douglas-Peucker algorithm. Fill the resulting bounding boxes.

    Afterwards, you can subtract resulting binary images from one another to find exact areas of intersections.

    Hope it helps!