๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ป Programming/Computer Vision

[openCV] ์ด๋ฏธ์ง€ ์œ„์— ์„ , ์‚ฌ๊ฐํ˜•, ์› ๊ทธ๋ฆฌ๊ธฐ

by ๋ญ…์ฆค 2022. 10. 31.
๋ฐ˜์‘ํ˜•

์ด๋ฏธ์ง€์—์„œ ๋ฌด์–ธ๊ฐ€ ๊ฒ€์ถœํ•˜๊ณ  ํ‘œ์‹œํ•  ๋•Œ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” 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()

๋ฐ˜์‘ํ˜•