Detected contours:
Notice how the 2nd internal rectangle is not detected as a single contour. Any ideas on what can be done here?