title: Fit internal rectangles to joints
body: <p>Using a joints array, like the following:</p>
  
  <p><a href="https://i.stack.imgur.com/QbwTq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QbwTq.png" alt="enter image description here"></a></p>
  
  <p>How can I fit the internal rectangles, so that no rectangles overlap and all points are used? Basically fitting table cells to the points.</p>
  
  <p>I've tried grabbing the contours, works fine:</p>
  
  <p><a href="https://i.stack.imgur.com/KBkbv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KBkbv.png" alt="enter image description here"></a></p>
  
  <p>With 22 points found. How can I fit these points to internal polygons? E.g. find the 21 rectangles in this image.</p>