-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (24 loc) · 790 Bytes
/
main.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
29
30
import cv2
import ScannerFunctions as sf
widthImg, heightImg = 480, 640
cap = cv2.VideoCapture(0)
cap.set(3, 640)
cap.set(4, 480)
cap.set(10, 150)
while True:
# success, img = cap.read()
img = cv2.imread("resources/test.jpeg")
img = cv2.resize(img,(widthImg,heightImg))
imgContour = img.copy()
imgThres = sf.preProcessing(img)
biggest = sf.getContours(imgThres, imgContour)
if biggest.size !=0:
imgWarped = sf.getWarp(img,biggest)
imageArray = ([img,imgThres], [imgContour,imgWarped])
cv2.imshow("ImageWarped", imgWarped)
else:
imageArray = ([img, imgThres], [img, img])
stackedImages = sf.stackImages(0.4,imageArray)
cv2.imshow("WorkFlow", stackedImages)
if cv2.waitKey(1) & 0xFF == ord('q'):
break