问题 Here's a receipt image that I've got and I've plotted it using matplotlib, # x1, y1, x2, y2, x3, y3, x4, y4 bbox_coords = [[650, 850], [1040, 850], [1040, 930], [650, 930]] image = cv2.imread(IMG_FILE) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) fig, ax = plt.subplots(figsize=(20, 20)) ax.imshow(gray, cmap='Greys_r'); rect = Polygon(bbox_coords, fill=False, linewidth=1, edgecolor='r') ax.add_patch(rect) plt.show() print(gray.shape) (4376, 2885) Then, I've cropped the original gray image