title: Cropping polygon with OpenCV rotates the polygon
body: <p>I'm trying to cut a parking spot from a large (1920x1080) image using OpenCV in Python like this:</p>
  <pre><code>def cut_polygon_ROI_from_img(image: np.ndarray, ROI) -&gt; np.ndarray:
      x, y, w, h = ROI.bounding_rect
      cropped = image[x:x + w, y:y + h].copy()
  
      points_arr = ROI.points - ROI.points.min(axis=0)
      mask = np.zeros(cropped.shape[:2], np.uint8)
      cv2.fillConvexPoly(mask, points_arr, color=(255, 255, 255))
  
      cropped = cv2.bitwise_and(cropped, cropped, mask=mask)
      return cropped
  </code></pre>
  <p>I measured the bounding points (which are in <code>ROI.points</code>) by hand. The <code>ROI.bounding_rect</code> holds the <code>cv2.boundingRect(points)</code> tuple, which was created from the points that I've measured by hand:</p>
  <pre><code>[[ 275 1420]
   [ 279 1531]
   [ 454 1616]
   [ 453 1503]]
  </code></pre>
  <p>Points are organized from top left clockwise. For some reason, after cutting I get:</p>
  <p><a href="https://i.stack.imgur.com/71suD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/71suD.png" alt="enter image description here" /></a></p>
  <p>For checking, I've cut a rectangle from <code>[ 275 1420]</code> (top left) to <code>[ 454 1616]</code> (bottom right) and I have:</p>
  <p><a href="https://i.stack.imgur.com/ZcXAg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZcXAg.png" alt="enter image description here" /></a></p>
  <p>As you can see, first and third points are OK, but second and fourth are flipped, i. e. reflected along the diagonal from first to third point. How can I fix this?</p>