mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
Merge pull request #92 from wabkia/zbar-qr-type-limit
This commit is contained in:
commit
4167ffcfac
@ -4,7 +4,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pyzbar.pyzbar import decode
|
from pyzbar.pyzbar import decode, ZBarSymbol
|
||||||
|
|
||||||
from fishy.helper.helper import get_documents
|
from fishy.helper.helper import get_documents
|
||||||
|
|
||||||
@ -28,7 +28,8 @@ def get_qr_location(og_img):
|
|||||||
mask = np.zeros_like(img)
|
mask = np.zeros_like(img)
|
||||||
cv2.drawContours(mask, cnt, i, 255, -1)
|
cv2.drawContours(mask, cnt, i, 255, -1)
|
||||||
x, y, w, h = cv2.boundingRect(cnt[i])
|
x, y, w, h = cv2.boundingRect(cnt[i])
|
||||||
qr_result = decode(og_img[y:h + y, x:w + x])
|
qr_result = decode(og_img[y:h + y, x:w + x],
|
||||||
|
symbols=[ZBarSymbol.QRCODE])
|
||||||
if qr_result:
|
if qr_result:
|
||||||
valid_crops.append(((x, y, x + w, y + h), area))
|
valid_crops.append(((x, y, x + w, y + h), area))
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ def get_qr_location(og_img):
|
|||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
def get_values_from_image(img):
|
def get_values_from_image(img):
|
||||||
try:
|
try:
|
||||||
for qr in decode(img):
|
for qr in decode(img, symbols=[ZBarSymbol.QRCODE]):
|
||||||
vals = qr.data.decode('utf-8').split(",")
|
vals = qr.data.decode('utf-8').split(",")
|
||||||
return float(vals[0]), float(vals[1]), float(vals[2])
|
return float(vals[0]), float(vals[1]), float(vals[2])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user