def decodeFile(fileName): if not os.path.isfile(fileName): print "It is not a valid file." return results = DynamsoftBarcodeReader.decodeFile(fileName) json = {} tmp = [] i = 0 # Convert results to JSON for result in results: key = formats[result[0]] value = result[1] tmp = [key, value] json[i] = tmp i += 1; return str(json)
def decodeFile(fileName): if not os.path.isfile(fileName): print "It is not a valid file." return results = DynamsoftBarcodeReader.decodeFile(fileName) json = {} tmp = [] i = 0 # Convert results to JSON for result in results: key = formats[result[0]] value = result[1] tmp = [key, value] json[i] = tmp i += 1 return str(json)
def initLicense(license): DynamsoftBarcodeReader.initLicense(license)
key_code = -1 fileName = '/home/caratred/test.jpg' while True: if is_camera_paused: if not is_saved: is_saved = True # Capture a frame from Webcam img = cv.QueryFrame(capture) # fileName = 'dynamsoft_barcode_test.jpg' # img = cv.LoadImage('dynamsoft_barcode_test.jpg') # Save captured frame to local disk cv.SaveImage(fileName, img) # Decode the captured image by Dynamsoft Barcode library results = DynamsoftBarcodeReader.decodeFile(fileName) print(results) top = 30 increase = 20 if results: for result in results: barcode_format = "Format: " + formats[result[0]] barcode_value = "Value: " + result[1] # Draw text cv.PutText(img, barcode_format, (10, top), font, (254, 142, 20)) top += increase cv.PutText(img, barcode_value, (10, top), font,
key_code = -1 fileName = 'test.jpg' while True: if is_camera_paused: if not is_saved: is_saved = True # Capture a frame from Webcam img = cv.QueryFrame(capture) # fileName = 'dynamsoft_barcode_test.jpg' # img = cv.LoadImage('dynamsoft_barcode_test.jpg') # Save captured frame to local disk cv.SaveImage(fileName, img) # Decode the captured image by Dynamsoft Barcode library results = DynamsoftBarcodeReader.decodeFile(fileName) print results top = 30 increase = 20 if results: for result in results: barcode_format = "Format: " + formats[result[0]] barcode_value = "Value: " + result[1] # Draw text cv.PutText(img, barcode_format, (10, top), font, (254, 142, 20)) top += increase cv.PutText(img, barcode_value,
def decodeFile(fileName): results = DynamsoftBarcodeReader.decodeFile(fileName) for result in results: print "barcode format: " + formats[result[0]] print "barcode value: " + result[1]