Skip to content

Commit

Permalink
Update test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yushulx committed Aug 14, 2024
1 parent 79e5de2 commit d87a34c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import cv2
import barcodeQrSDK
from time import sleep

# set license
barcodeQrSDK.initLicense("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==")
ret = barcodeQrSDK.initLicense(
"DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==")
print('initLicense: {}'.format(ret))

# initialize barcode reader
reader = barcodeQrSDK.createInstance()
Expand Down Expand Up @@ -31,7 +34,6 @@
print(result.y4)

# decodeMat()
import cv2
image = cv2.imread("test.png")
results, elapsed_time = reader.decodeMat(image)
print('Elapsed time: ' + str(elapsed_time) + 'ms')
Expand All @@ -50,6 +52,8 @@
# decodeMatAsync()
print('')
print('Test decodeMatAsync()')


def callback(results, elapsed_time):
print('Elapsed time: ' + str(elapsed_time) + 'ms')
for result in results:
Expand All @@ -63,9 +67,9 @@ def callback(results, elapsed_time):
print(result.y3)
print(result.x4)
print(result.y4)
import cv2


image = cv2.imread("test.png")
reader.addAsyncListener(callback)
reader.decodeMatAsync(image)
sleep(1)
sleep(1)

0 comments on commit d87a34c

Please sign in to comment.