import cv2
import numpy as np
import matplotlib.pyplot as plt
image = cv2.imread('images/input.jpg')
plt.imshow(image[...,::-1])
<matplotlib.image.AxesImage at 0x2bc64c663a0>
height, width = image.shape[:2]
# Simply use indexing to crop out the rectangle we desire
cropped = image[250:400 , 250:550]
plt.imshow(cropped[...,::-1])
<matplotlib.image.AxesImage at 0x2bc64d1baf0>
cv2.imshow("original", image)
cv2.imshow("cropped", cropped)
cv2.waitKey()
cv2.destroyAllWindows()
height, width = image.shape[:2]
# Simply use indexing to crop out the rectangle we desire
cropped = image[250:400 , 250:550]
plt.imshow(cropped[...,::-1])