text_plain_output_2.png text_plain_output_1.png
from imutils.contours import sort_contours

from matplotlib import cm

import cv2

import imutils

import matplotlib.pyplot as plt

image_path = '/kaggle/input/tester2/pja 4.jpg'
image = cv2.imread(image_path)

edged = cv2.Canny(blurred, 30, 250)
cnts = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
cnts = sort_contours(cnts, method='left-to-right')[0]
figure = plt.figure(figsize=(7, 7))
plt.axis('off')
plt.imshow(edged, cmap=cm.binary_r)