fffiloni commited on
Commit
b6c46c4
1 Parent(s): 931bb21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -4,7 +4,7 @@ import numpy as np
4
 
5
  def preprocess(img):
6
  img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
7
- _, img_thresh = cv2.threshold(img_gray, 127, 255, cv2.THRESH_BINARY)
8
  img_dilate = cv2.dilate(img_thresh, np.ones((3, 3)), iterations=2)
9
  img_erode = cv2.erode(img_dilate, np.ones((3, 3)), iterations=1)
10
  return img_erode
 
4
 
5
  def preprocess(img):
6
  img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
7
+ img_thresh = cv2.adaptiveThreshold(img_gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)
8
  img_dilate = cv2.dilate(img_thresh, np.ones((3, 3)), iterations=2)
9
  img_erode = cv2.erode(img_dilate, np.ones((3, 3)), iterations=1)
10
  return img_erode