Skip to content

2.Crop

範囲を指定してCrop

1
2
3
4
5
6
7
8
from matplotlib import pyplot as plt
import cv2

image_path = 'GTSRB/Final_Training/Images/00000/00000_00000.ppm'
image = plt.imread(image_path)
crop_image = image[5:25, 0:30, :]
plt.imshow(crop_image, cmap=plt.cm.gray_r,); 
plt.show()