mertbozkurt commited on
Commit
829dde3
·
1 Parent(s): d1c33d5

Update optic1.py

Browse files
Files changed (1) hide show
  1. optic1.py +5 -4
optic1.py CHANGED
@@ -61,8 +61,9 @@ def optic1(ans_txt,pathImage, save_images= True):
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
-
 
66
  #second buyuk icin perspektif
67
  secondContour=functions.reorder(secondContour)
68
  pts1_2 = np.float32(secondContour)
@@ -70,8 +71,8 @@ def optic1(ans_txt,pathImage, save_images= True):
70
  matrix_2 = cv2.getPerspectiveTransform(pts1_2, pts2_2)
71
  imgWarpColored_2 = cv2.warpPerspective(img, matrix_2, (wrap_v, wrap_h))
72
  imgWarpGray_2 = cv2.cvtColor(imgWarpColored_2,cv2.COLOR_BGR2GRAY)
73
- imgThresh_2 = cv2.threshold(imgWarpGray_2, 170, 255,cv2.THRESH_BINARY_INV )[1]
74
-
75
 
76
  #student id
77
  bubbles = functions.split_num(imgThresh_2, 10, 10)
 
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 = cv.threshold(imgWarpColored_1,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)[1]
66
+
67
  #second buyuk icin perspektif
68
  secondContour=functions.reorder(secondContour)
69
  pts1_2 = np.float32(secondContour)
 
71
  matrix_2 = cv2.getPerspectiveTransform(pts1_2, pts2_2)
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 = cv.threshold(imgWarpColored_2,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)[1]
76
 
77
  #student id
78
  bubbles = functions.split_num(imgThresh_2, 10, 10)