最終更新:2021-04-28 (水) 01:57:35 (1094d)  

cv2.minAreaRect
Top / cv2.minAreaRect

https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_contours/py_contour_features/py_contour_features.html

rect = cv2.minAreaRect(cnt)
box = cv2.boxPoints(rect)
box = np.int0(box)
im = cv2.drawContours(im,[box],0,(0,0,255),2)

サンプル

メモ

  • (左上の座標(x,y), (幅, 高さ), 回転角)を含むBox2D構造のものを返す
    (cx, cy), (width, height), angle = rect

処理

cv2.boxPoints?

np.int0

cv2.drawContours

box

  • 4つの点のリスト

関連

参考