# 검정 바탕 이미지에 빨간 선분 그리기
start_point, end_point = (0, 0), (img_black.shape[1], img_black.shape[0])
color, line_thickeness, line_type = (0, 0, 255), 1, cv2.LINE_AA
img_black = cv2.line(img_black, start_point, end_point, color, line_thickness, line_type)
cv2.line(image, start_point, end_point, color, line_thickness, line_type)
인자
# 검정 바탕 이미지 중점에 반지름이 30인 파란 원 그리기
center_point = (img_black.shape[1] // 2, img_black.shape[0] // 2)
radius, color, line_thickeness, line_type = 30, (255, 0, 0), 1, cv2.LINE_AA
img_black = cv2.circle(img_black, center_point, radius, color, line_thickeness, line_type)
cv2.circle(image, center_point, radius, color, line_thickness, line_type)
인자
# 검정 바탕 이미지 중점에 20 x 20 초록 사각형 그리기
width, height = 20, 20
top_left = center_point[0] - (width // 2), center_point[1] - (height // 2)
bottom_right = center_point[0] + (width // 2), center_point[1] + (height // 2)
color, line_thickeness, line_type = (0, 255, 0), 1, cv2.LINE_AA
img_black = cv2.rectangle(img_black, top_left, bottom_right, color, line_thickeness, line_type)
cv2.rectangle(image, top_left, bottom_right, color, line_thickness, line_type)
인자
# 검정 바탕 이미지에 (30, 30)위치에 하얀 글씨 쓰기
text_bottom_left = (30, 30)
font_type, font_scale = cv2.FONT_HERSHEY_COMPLEX, 0.4
color, line_thickeness, line_type = (255, 255, 255), 1, cv2.LINE_AA
img_black = cv2.putText(img_black, "OpenCV", text_bottom_left, font_type, font_scale, color, line_thickeness, line_type)
cv2.putText(image, string, text_bottom_left, font_type, font_scale, color, line_thickeness, line_type)