소스 뷰어
원 그리기
  • cv2.circle(image, center, redius, color[, thickness[, lineType[, shift]]])
    • image : 원을 그릴 대상 행렬 (영상)
    • center : 원의 중심 좌표
    • redius : 원의 반지름
    • color : 선의 색상
    • thickness : 선의 두께
    • lineType : 선의 형태 cv2.line() 함수의 인수와 동일
    • shift : 좌표에 대한 비트 시프트 연산
import numpy as np
import cv2
from matplotlib import pyplot as plt

red, green, blue  = (255, 0, 0), (0, 255, 0), (0,0,255)
white, black = (255, 255, 255), (0,0,0)
image = np.full((300, 500,3),white, np.uint8)

center = (image.shape[1]//2, image.shape[0]//2) # 중심 좌표 - 역순 구성
pt1, pt2 = (300, 50), (100, 220) # 문자열 위치 좌표
shade = (pt2[0] + 2, pt2[1] + 2) # 그림자 좌표

cv2.circle(image, center, 100, blue)
cv2.circle(image, pt1, 50, green, 2)
cv2.circle(image, pt2, 70, red, -1)

font = cv2.FONT_HERSHEY_COMPLEX # 폰트 지정

cv2.putText(image, "center_blue", center, font, 1.0, blue)
cv2.putText(image, "pt1_green", pt1, font, 0.8, green)
cv2.putText(image, "pt2_red", shade,font, 1.2, black, 2)
cv2.putText(image, "pt2_red", pt2, font, 1.2, red, 1)

plt.imshow(image)
plt.show()
No description has been provided for this image