You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

19 lines
316 B

# 実験課題4
# 3.4 ROIの利用
import cv2
image_path = 'sample.jpg'
img = cv2.imread(image_path)
if img is not None:
height, width = img.shape[:2]
start_y = 248
end_y = 361
start_x = 67
end_x = 208
roi_img = img[start_y:end_y, start_x:end_x]
cv2.imwrite('3_4_roi.jpg', roi_img)