emilios commited on
Commit
c5b9e50
1 Parent(s): 61d1760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -5,20 +5,18 @@ import numpy as np
5
 
6
 
7
  def inference(img):
8
- #my_result = cv2.erode(img,(1,1))
9
- #my_result = cv2.dilate(my_result,(1,1))
10
  # https://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.remove_small_objects
11
  # my_result = cv2.remove_small_objects(binarized.astype(bool), min_size=2, connectivity=2).astype(int)
12
 
13
- img_bw = 255*(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) > 5).astype('uint8')
14
-
15
- se1 = cv2.getStructuringElement(cv2.MORPH_RECT, (5,5))
16
- se2 = cv2.getStructuringElement(cv2.MORPH_RECT, (2,2))
17
- mask = cv2.morphologyEx(img_bw, cv2.MORPH_CLOSE, se1)
18
- mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, se2)
19
-
20
- mask = np.dstack([mask, mask, mask]) / 255
21
- out = img * mask
22
 
23
  return out
24
 
 
5
 
6
 
7
  def inference(img):
8
+ out = cv2.erode(img,(1,1))
9
+ out = cv2.dilate(my_result,(1,1))
10
  # https://scikit-image.org/docs/dev/api/skimage.morphology.html#skimage.morphology.remove_small_objects
11
  # my_result = cv2.remove_small_objects(binarized.astype(bool), min_size=2, connectivity=2).astype(int)
12
 
13
+ #img_bw = 255*(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) > 5).astype('uint8')
14
+ #se1 = cv2.getStructuringElement(cv2.MORPH_RECT, (5,5))
15
+ #se2 = cv2.getStructuringElement(cv2.MORPH_RECT, (2,2))
16
+ #mask = cv2.morphologyEx(img_bw, cv2.MORPH_CLOSE, se1)
17
+ #mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, se2)
18
+ #mask = np.dstack([mask, mask, mask]) / 255
19
+ #out = img * mask
 
 
20
 
21
  return out
22