最終更新:2021-04-28 (水) 01:57:35 (1056d)
cv2.minAreaRect
Top / cv2.minAreaRect
rect = cv2.minAreaRect(cnt) box = cv2.boxPoints(rect) box = np.int0(box) im = cv2.drawContours(im,[box],0,(0,0,255),2)
サンプル
- https://github.com/opencv/opencv/blob/master/samples/python/text_skewness_correction.py
angle = cv.minAreaRect(coords)[-1]
メモ
- (左上の座標(x,y), (幅, 高さ), 回転角)を含むBox2D構造のものを返す
(cx, cy), (width, height), angle = rect
処理
cv2.boxPoints?
np.int0
cv2.drawContours
box
- 4つの点のリスト