Spaces:
Runtime error
Runtime error
Commit
·
2f6ebcb
1
Parent(s):
1377edd
Update optic1.py
Browse files
optic1.py
CHANGED
@@ -58,10 +58,11 @@ def optic1(ans_txt,pathImage, save_images= True):
|
|
58 |
pts1 = np.float32(biggestContour)
|
59 |
pts2 = np.float32([[0, 0],[wrap_v, 0], [0, wrap_h],[wrap_v, wrap_h]])
|
60 |
matrix = cv2.getPerspectiveTransform(pts1, pts2)
|
61 |
-
|
62 |
imgWarpColored_1 = cv2.warpPerspective(img, matrix, (wrap_v, wrap_h))
|
63 |
imgWarpGray_1 = cv2.cvtColor(imgWarpColored_1,cv2.COLOR_BGR2GRAY)
|
64 |
# imgThresh_1 = cv2.threshold(imgWarpGray_1, 170, 255,cv2.THRESH_BINARY_INV )[1]
|
|
|
65 |
imgThresh_1 = cv2.threshold(imgWarpColored_1,0,255,cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
|
66 |
|
67 |
#second buyuk icin perspektif
|
@@ -72,6 +73,7 @@ def optic1(ans_txt,pathImage, save_images= True):
|
|
72 |
imgWarpColored_2 = cv2.warpPerspective(img, matrix_2, (wrap_v, wrap_h))
|
73 |
imgWarpGray_2 = cv2.cvtColor(imgWarpColored_2,cv2.COLOR_BGR2GRAY)
|
74 |
#imgThresh_2 = cv2.threshold(imgWarpGray_2, 170, 255,cv2.THRESH_BINARY_INV )[1]
|
|
|
75 |
imgThresh_2 = cv2.threshold(imgWarpColored_2,0,255,cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
|
76 |
|
77 |
#student id
|
|
|
58 |
pts1 = np.float32(biggestContour)
|
59 |
pts2 = np.float32([[0, 0],[wrap_v, 0], [0, wrap_h],[wrap_v, wrap_h]])
|
60 |
matrix = cv2.getPerspectiveTransform(pts1, pts2)
|
61 |
+
|
62 |
imgWarpColored_1 = cv2.warpPerspective(img, matrix, (wrap_v, wrap_h))
|
63 |
imgWarpGray_1 = cv2.cvtColor(imgWarpColored_1,cv2.COLOR_BGR2GRAY)
|
64 |
# imgThresh_1 = cv2.threshold(imgWarpGray_1, 170, 255,cv2.THRESH_BINARY_INV )[1]
|
65 |
+
imgWarpColored_1 = cv2.convertScaleAbs(imgWarpColored_1)
|
66 |
imgThresh_1 = cv2.threshold(imgWarpColored_1,0,255,cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
|
67 |
|
68 |
#second buyuk icin perspektif
|
|
|
73 |
imgWarpColored_2 = cv2.warpPerspective(img, matrix_2, (wrap_v, wrap_h))
|
74 |
imgWarpGray_2 = cv2.cvtColor(imgWarpColored_2,cv2.COLOR_BGR2GRAY)
|
75 |
#imgThresh_2 = cv2.threshold(imgWarpGray_2, 170, 255,cv2.THRESH_BINARY_INV )[1]
|
76 |
+
imgWarpColored_2 = cv2.convertScaleAbs(imgWarpColored_2)
|
77 |
imgThresh_2 = cv2.threshold(imgWarpColored_2,0,255,cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
|
78 |
|
79 |
#student id
|