Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,9 @@ def decode(im,col):
|
|
17 |
newData = []
|
18 |
h1 = col.strip("#")
|
19 |
rgb_tup = tuple(int(h1[i:i+2], 16) for i in (0, 2, 4))
|
|
|
20 |
for item in datas:
|
21 |
-
if item[0]
|
22 |
newData.append((0,0,0))
|
23 |
else:
|
24 |
newData.append((255,255,255))
|
@@ -27,6 +28,7 @@ def decode(im,col):
|
|
27 |
img = cv2.imread('conv_im.png')
|
28 |
try:
|
29 |
results = zxingcpp.read_barcodes(img)
|
|
|
30 |
return results[0].text
|
31 |
except Exception:
|
32 |
return "QR Code not Detected \nTry choosing the QR code color using the eyedropper in the Color Picker"
|
|
|
17 |
newData = []
|
18 |
h1 = col.strip("#")
|
19 |
rgb_tup = tuple(int(h1[i:i+2], 16) for i in (0, 2, 4))
|
20 |
+
|
21 |
for item in datas:
|
22 |
+
if item[0] in range(rgb_tup[0]-5,rgb_tup[0]+5) and item[1] == rgb_tup[1] and item[2] == rgb_tup[2]:
|
23 |
newData.append((0,0,0))
|
24 |
else:
|
25 |
newData.append((255,255,255))
|
|
|
28 |
img = cv2.imread('conv_im.png')
|
29 |
try:
|
30 |
results = zxingcpp.read_barcodes(img)
|
31 |
+
print (results[0].text)
|
32 |
return results[0].text
|
33 |
except Exception:
|
34 |
return "QR Code not Detected \nTry choosing the QR code color using the eyedropper in the Color Picker"
|