DerrylNessie commited on
Commit
cd02c9c
1 Parent(s): d2b87eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -21,12 +21,11 @@ def midpoint(x1, y1, x2, y2):
21
  return (x_mid, y_mid)
22
 
23
  def draw_boxes(img, bounds, color='yellow', width=2):
24
-
25
  mask = np.zeros(img.shape[:2], dtype="uint8")
26
- draw = ImageDraw.Draw(mask)
27
  for bound in bounds:
28
- p0, p1, p2, p3 = bound[0]
29
- draw.polygon((*p0, *p1, *p2, *p3), fill=255)
 
30
  return (mask)
31
 
32
  def draw_mask(img, bounds):
@@ -45,9 +44,9 @@ def draw_mask(img, bounds):
45
  thickness = int(math.sqrt((x2 - x1)**2 + (y2 - y1)**2))
46
 
47
  cv.line(mask, (x_mid0, y_mid0), (x_mid1, y_mi1), 255, thickness)
48
- img = cv.inpaint(img, mask, 1, cv.INPAINT_NS)
49
 
50
- return(img)
51
 
52
  def inference(img, lang):
53
  if lang == "english":
 
21
  return (x_mid, y_mid)
22
 
23
  def draw_boxes(img, bounds, color='yellow', width=2):
 
24
  mask = np.zeros(img.shape[:2], dtype="uint8")
 
25
  for bound in bounds:
26
+ pts = np.array([bound[0]], np.int32)
27
+ pts = pts.reshape((-1,1,2))
28
+ cv.polylines(mask,[pts],True,(0,255,255))
29
  return (mask)
30
 
31
  def draw_mask(img, bounds):
 
44
  thickness = int(math.sqrt((x2 - x1)**2 + (y2 - y1)**2))
45
 
46
  cv.line(mask, (x_mid0, y_mid0), (x_mid1, y_mi1), 255, thickness)
47
+ #img = cv.inpaint(img, mask, 1, cv.INPAINT_NS)
48
 
49
+ return(mask)
50
 
51
  def inference(img, lang):
52
  if lang == "english":