Omnibus commited on
Commit
0a9a758
·
1 Parent(s): e064287

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -6,9 +6,16 @@ import cv2
6
 
7
  def decode(im,col):
8
  img = cv2.imread(f'{im}')
 
 
 
 
 
 
 
9
  try:
10
- results = zxingcpp.read_barcodes(img)
11
- return results[0].text,None
12
  except Exception:
13
 
14
  #qr_img=Image.open(im).convert("RGBA")
 
6
 
7
  def decode(im,col):
8
  img = cv2.imread(f'{im}')
9
+ gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
10
+ blur = cv2.medianBlur(gray, 5)
11
+ sharpen_kernel = np.array([[-1,-1,-1], [-1,9,-1], [-1,-1,-1]])
12
+ sharpen = cv2.filter2D(blur, -1, sharpen_kernel)
13
+
14
+
15
+
16
  try:
17
+ results = zxingcpp.read_barcodes(sharpen)
18
+ return results[0].text,sharpen
19
  except Exception:
20
 
21
  #qr_img=Image.open(im).convert("RGBA")