๋ฐ์ํ
์ด๋ฏธ์ง์์ ๋ฌด์ธ๊ฐ ๊ฒ์ถํ๊ณ ํ์ํ ๋ ๊ฐ์ฅ ๋ง์ด ์ฌ์ฉํ๋ line, rectangle, circle ์ธ ๊ฐ์ง ๊ฐ๋จ ์ ๋ฆฌ.
cv2.line(์ด๋ฏธ์ง, (์์์ขํ), (๋ ์ขํ), ์ปฌ๋ฌ, ๋๊ป)
cv2.rectangle(์ด๋ฏธ์ง, (์ข์๋จ ์ขํ), (์ฐํ๋จ ์ขํ), ์ปฌ๋ฌ, ๋๊ป)
cv2.circle(์ด๋ฏธ์ง, (์ค์ฌ ์ขํ), ๋ฐ์ง๋ฆ, ์ปฌ๋ฌ, ๋๊ป)
import numpy as np
import cv2
black_canvas = np.zeros((500,500,3))
R, G, B = (0,0,255), (0,255,0), (255,0,0)
cv2.line(black_canvas, (10,100),(500,300), R, thickness=10)
cv2.rectangle(black_canvas, (10, 10), (110, 110), G,10)
cv2.circle(black_canvas,(200,200),50, B,10)
cv2.imshow('test', black_canvas)
cv2.waitKey(0)
cv2.destroyAllWindows()
๋ฐ์ํ