Deep Learning/Computer Vision

OpenCV (10) - 사각형 그리기

Jun's N 2022. 6. 4. 21:00

사각형 그리기

cv2.rectangle(image, start, end, color, thickness)

start : 시작 좌표(2차원)
end : 종료 좌표(2차원)
thickness : 선의 두께
thickness = -1 : 채워진 사각형

import cv2
import numpy as np
import matplotlib.pyplot as plt

image = np.full((512, 512, 3), 255, np.uint8)
image = cv2.rectangle(image, (20, 20), (255, 255), (255, 0, 0) , 3) 

plt.imshow(image)
plt.show()
728x90