How to crop each character on an image using Python OpenCV?
问题 I have generated OpenCV image like this From the last line of code, how do I crop and show each character in the current image separately? Code labels = measure.label(thresh, connectivity=2, background=0) charCandidates = np.zeros(thresh.shape, dtype="uint8") for label in np.unique(labels): if label == 0: continue labelMask = np.zeros(thresh.shape, dtype="uint8") labelMask[labels == label] = 255 cnts = cv2.findContours(labelMask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) cnts = imutils.grab