I have found the following code on this website:
import os import os.path import cv2 import glob import imutils CAPTCHA_IMAGE_FOLDER = \"generated_captcha_im
(x, y, w, h) = cv2.boundingRect(contour.astype(np.int))