PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import cv2
import numpy as np
import rect
# add image here.
# We can also use laptop's webcam if the resolution is good enough to capture
# readable document content
image = cv2.imread('test_s1.jpg')
#cv2.imshow('test_s1.jpg',image)
#cv2.waitKey(0)
#cv2.destroyAllWindows()
# resize image so it can be processed
# choose optimal dimensions such that important content is not lost
image = cv2.resize(image, (1500, 880))
# creating copy of original image
orig = image.copy()
# convert to grayscale and blur to smooth
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
#blurred = cv2.medianBlur(gray, 5)
# apply Canny Edge Detection
edged = cv2.Canny(blurred, 0, 50)
orig_edged = edged.copy()
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run