fjenett commited on
Commit
038e67f
1 Parent(s): af0f82d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -11
app.py CHANGED
@@ -17,10 +17,10 @@ def detect_ellipses(img_path):
17
  imgG = cv2.cvtColor(imgC, cv2.COLOR_BGR2GRAY)
18
 
19
  ammed_size = 600
20
-
21
  iheight, iwidth = imgG.shape
 
22
  imax = max(iheight, iwidth)
23
- iscale = ammed_size / imax
24
  is_landscape = iwidth >= iheight
25
  if is_landscape:
26
  iw = imax * iscale
@@ -30,15 +30,6 @@ def detect_ellipses(img_path):
30
  ih = imax * iscale
31
 
32
  imgG = cv2.resize(imgG, (int(iw), int(ih)))
33
-
34
- if is_landscape:
35
- ipad = int((ammed_size - ih) / 2)
36
- imgG = cv2.copyMakeBorder(imgG, ipad, ipad, 0, 0, cv2.BORDER_REPLICATE)
37
- else:
38
- ipad = int((ammed_size - iw) / 2)
39
- imgG = cv2.copyMakeBorder(imgG, 0, 0, ipad, ipad, cv2.BORDER_REPLICATE)
40
-
41
- imgG = cv2.resize(imgG, (ammed_size, ammed_size)) # just to make sure
42
 
43
  aamed = pyAAMED(ammed_size, ammed_size)
44
  aamed.setParameters(3.1415926/3, 3.4, 0.77)
 
17
  imgG = cv2.cvtColor(imgC, cv2.COLOR_BGR2GRAY)
18
 
19
  ammed_size = 600
 
20
  iheight, iwidth = imgG.shape
21
+
22
  imax = max(iheight, iwidth)
23
+ iscale = (ammed_size - 1) / imax
24
  is_landscape = iwidth >= iheight
25
  if is_landscape:
26
  iw = imax * iscale
 
30
  ih = imax * iscale
31
 
32
  imgG = cv2.resize(imgG, (int(iw), int(ih)))
 
 
 
 
 
 
 
 
 
33
 
34
  aamed = pyAAMED(ammed_size, ammed_size)
35
  aamed.setParameters(3.1415926/3, 3.4, 0.77)