title: Overlapping shapes recognition (OpenCV)
body: <p>I have a simple image containing some shapes: some rectangles and some ellipses, in total number of 4 or 5. The shapes can be rotated, scaled and overlapped. There is a sample input:
  <a href="https://i.stack.imgur.com/GQLYD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GQLYD.png" alt="Sample image"></a>
  My task is to detect all of these figures and prepare some information about them: size, position, rotation, etc. In my opinion, the core problem is the fact that the shapes can be overlapped by each other. I tried to search some information about this kind of problem and find that OpenCV library can be very useful.</p>
  
  <p>OpenCV has the ability to detect contours and then try to fit ellipses or rectangles to these contours. The problem is when shapes are overllaped, the contours are mixed up.</p>
  
  <p>I think about following algorithm: detect all characteristic points: and put white dot at them. I got something like these where every figure is divided into separate sections:
  <a href="https://i.stack.imgur.com/GiURT.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/GiURT.jpg" alt="enter image description here"></a>
  Then I can try to link these parts using some information, for example the complexity value (I fit the curve approxPolyDP to the contour and the read how many parts it has). But it starts to be very hard. The other idea is to try all of the permutations of linking the contours and trying to fit the figures to them. The best compilation will be output. </p>
  
  <p>Any ideas how to create simple but elegant solution?</p>