title: Find Rotated Rectangle in OpenCV Python
body: <p>i have python function like below</p>
  <pre><code>def getContours(img, imgContour):
      contours, hierarchy = cv2.findContours(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)[-2:]
  
      for cnt in contours:
          area = cv2.contourArea(cnt)
          if area &gt; 1000:
              cv2.drawContours(imgContour, contours, -1, (255, 0, 255), 7)
              peri = cv2.arcLength(cnt, True)
              approx = cv2.approxPolyDP(cnt, 0.02 * peri, True)
              # print(len(approx))
              x, y, w, h = cv2.boundingRect(approx)
              #cv2.rectangle(imgContour, (x, y), (x + w, y + h), (0, 255, 0), 5)
  
              if len(approx) == 3:
                  cv2.putText(imgContour, &quot;Segitiga&quot;, (x, y), cv2.FONT_HERSHEY_COMPLEX, 1, 0, 2)
              elif len(approx) == 4:
                  (x, y, w, h) = cv2.boundingRect(approx)
                  ar = w / float(h)
                  print(ar)
                  if ar &gt;= 0.95 and ar &lt;= 1.05:
                      cv2.putText(imgContour, &quot;Persegi&quot;, (x, y), cv2.FONT_HERSHEY_COMPLEX, 1, 0, 2)
                  else:
                      cv2.putText(imgContour, &quot;Segi Panjang&quot;, (x, y), cv2.FONT_HERSHEY_COMPLEX, 1, 0, 2)
              else:
                  cv2.putText(imgContour, &quot;Lingkaran/Octagon&quot;, (x, y), cv2.FONT_HERSHEY_COMPLEX, 1, 0, 2)
  </code></pre>
  <p>how do I know that the rectangle detected in the image has a rotation of 45 (rhombus)? I haven't found a function in opencv related to rotation detection</p>