OpenCV(Open Source Computer Vision)
pip install opencv-python
import cv2
# 이미지 파일 열기
image = cv2.imread('input_image.jpg')
# 이미지 출력을 위한 윈도우 창 호출
cv2.imshow('Test Image', image)
cv2.waitKey(0) # 사용자 입력(아무 키) 대기
cv2.destroyAllWindows() # 사용자 입력 시, 호출된 이미지 종료
# 이미지 다른 파일로 저장
cv2.imwrite('path\output_image.jpg', image)
# 파일경로, 파일명 영문으로 설정
# 사각형 그리기
point_1 = (x1, y1); point_2 = (x2, y2) # 좌표 설정
color = (0, 255, 0) # 선의 색 설정 (B, G, R)
thickness = 2 # 선의 두께 설정
cv2.rectangle(image, point_1, point_2, color, thickness)
# 이미지 파일 크기 확인
height, width = image.shape[:2]