opencv 회전 사각형


opencv 회전 사각형

import cv2 import numpy as np img = np.zeros(shape=(500, 500, 3), dtype=np.uint8) x, y = 256, 256 size = 200 for angle in range(0, 90, 10): # 맨 오른쪽 정수의 값이 클 수록 도형의 개수가 적어지고, 수가 작을 수록 도형이 많아진다. rect = ((256, 256), (size, size), angle) # angle은 회전각도 이다. box = cv2.boxPoints(rect).astype(np.int32) r = np.random.randint(256) # 0~255 까지 랜덤 난수 생성, 랜덤 색상 지정 g = np.random.randint(256) # 0~255 까지 랜덤 난수 생성 b = np.random.randint(256) # 0~255 까지 랜덤 난수 생성 cv2.polylines(img, [box], True, (b, g, r), 2) cv2.imsh...



원문링크 : opencv 회전 사각형