How can I crop images, like I\'ve done before in PIL, using OpenCV.
Working example on PIL
im = Image.open(\'0.png\').convert(\'L\') im = im.crop((1
It's very simple. Use numpy slicing.
import cv2 img = cv2.imread("lenna.png") crop_img = img[y:y+h, x:x+w] cv2.imshow("cropped", crop_img) cv2.waitKey(0)