def readImage(img_path): image = cv2.imread(img_path) image = imutils.resize(image, width=500) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) return image, gray