diff --git a/LICENSE.md b/LICENSE.md
index 59fc9a8..850b9be 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -2,4 +2,4 @@ License Notice
This folder contains code samples ("Sample Code") for use with Dynamsoft Barcode Reader, a commercial software development kit licensed by Dynamsoft. The Sample Code may be modified and included in your end user software under the terms of the Dynamsoft Software License Agreement https://www.dynamsoft.com/barcode-reader/license-agreement/ (“Commercial License”). Except as expressly stated in the Commercial License, no other rights are granted in the Sample Code. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-Copyright © 2003–2021 Dynamsoft. All rights reserved.
\ No newline at end of file
+Copyright © 2003–2022 Dynamsoft. All rights reserved.
\ No newline at end of file
diff --git a/README.md b/README.md
index 45e3e17..88c90b3 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Dynamsoft Barcode Reader samples for Python edition
[](https://pypi.org/project/dbr/)
-[](https://www.python.org/downloads/)
+[](https://www.python.org/downloads/)
[](https://pypistats.org/packages/dbr)

@@ -23,6 +23,7 @@ This repository contains multiple samples that demonstrates how to use the [Dyna
- Python3.7
- Python3.8
- Python3.9
+- Python3.10
## Installation
@@ -49,8 +50,13 @@ https://www.dynamsoft.com/barcode-reader/programming/python/?ver=latest&utm_sour
## License
-- If you want to use an offline license, please contact [Dynamsoft Support](https://www.dynamsoft.com/company/contact/)
-- You can also request a 30-day trial license in the [customer portal](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python)
+The library requires a license to work, you use the API init_license to initialize license key and activate the SDK.
+
+These samples use a free public trial license. Note that network connection is required for this license to work.
+
+You can also request a 30-day trial license from Customer Portal
+
+For more information, please refer to https://www.dynamsoft.com/license-server/docs/about/licensefaq.html.
## Contact Us
diff --git a/samples/general-settings.py b/samples/general-settings.py
index e56a4f7..dea9ee2 100644
--- a/samples/general-settings.py
+++ b/samples/general-settings.py
@@ -4,12 +4,9 @@
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/hello-world.py b/samples/hello-world.py
index 4ee4086..e2e7630 100644
--- a/samples/hello-world.py
+++ b/samples/hello-world.py
@@ -4,12 +4,9 @@
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/image-decoding.py b/samples/image-decoding.py
index 7c91e1d..3144bfa 100644
--- a/samples/image-decoding.py
+++ b/samples/image-decoding.py
@@ -25,12 +25,9 @@ def choose_number() -> int:
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/performance/accuracy-first-settings.py b/samples/performance/accuracy-first-settings.py
index 2df13ec..bc6aa8f 100644
--- a/samples/performance/accuracy-first-settings.py
+++ b/samples/performance/accuracy-first-settings.py
@@ -47,12 +47,9 @@ def output_results(results:TextResult):
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/performance/batch-decode.py b/samples/performance/batch-decode.py
index 7a1fce2..916af14 100644
--- a/samples/performance/batch-decode.py
+++ b/samples/performance/batch-decode.py
@@ -6,12 +6,9 @@
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/performance/read-rate-first-settings.py b/samples/performance/read-rate-first-settings.py
index 46af41e..c48bba8 100644
--- a/samples/performance/read-rate-first-settings.py
+++ b/samples/performance/read-rate-first-settings.py
@@ -74,12 +74,9 @@ def output_results(results:TextResult):
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/performance/speed-first-settings.py b/samples/performance/speed-first-settings.py
index 422d121..dfd43fc 100644
--- a/samples/performance/speed-first-settings.py
+++ b/samples/performance/speed-first-settings.py
@@ -80,12 +80,9 @@ def output_results(results:TextResult):
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/use-case/read-dpm-barcode.py b/samples/use-case/read-dpm-barcode.py
index 811a7b2..a086f6b 100644
--- a/samples/use-case/read-dpm-barcode.py
+++ b/samples/use-case/read-dpm-barcode.py
@@ -17,12 +17,9 @@ def output_results(results:TextResult):
if __name__ == "__main__":
try:
# 1.Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
diff --git a/samples/video-decoding-for-picamera.py b/samples/video-decoding-for-picamera.py
index a526a96..266260a 100644
--- a/samples/video-decoding-for-picamera.py
+++ b/samples/video-decoding-for-picamera.py
@@ -9,11 +9,8 @@
import cv2
# you can change the following variables' value to your own value.
-license_key = "Input your own license"
json_file = r"Please input your own template path"
-reader = BarcodeReader()
-
def intermediate_results_callback_func(frame_id, i_results, user_data):
print(frame_id)
for result in i_results:
@@ -163,22 +160,14 @@ def read_barcode():
print("-------------------start------------------------")
-# Apply for a trial license: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github
-reader.init_license(license_key)
-
-## The code snippet below shows how to use the full license in DBR 8.x:
-# connection_paras = BarcodeReader.init_dls_connection_parameters()
-## If DBR service is already built on your server, you can fill in the address of your server, or leave this property's default value.
-# connection_paras.main_server_url = "Input your own server url"
-# connection_paras.handshake_code = "Input your own handshake"
-# connection_paras.deployment_type = EnumDMDeploymentType.DM_DT_DESKTOP
-# connection_paras.uuid_generation_method = EnumDMUUIDGenerationMethod.DM_UUIDGM_RANDOM
-# try:
-# error = BarcodeReader.init_license_from_dls(connection_paras)
-# if error[0] != EnumErrorCode.DBR_OK:
-# print(error[1])
-# except BarcodeReaderError as bre:
-# print(bre)
+# Initialize license.
+# The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
+# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
+error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
+if error[0] != EnumErrorCode.DBR_OK:
+ print("License error: "+ error[1])
+
+reader = BarcodeReader()
error = reader.init_runtime_settings_with_file(json_file)
if error[0] != EnumErrorCode.DBR_OK:
diff --git a/samples/video-decoding.py b/samples/video-decoding.py
index d1583ea..ff506fd 100644
--- a/samples/video-decoding.py
+++ b/samples/video-decoding.py
@@ -39,8 +39,8 @@ def decode_video():
# video_file = "Put your video file path here."
# vc = cv2.VideoCapture(video_file)
- video_width = vc.get(cv2.CAP_PROP_FRAME_WIDTH)
- video_height = vc.get(cv2.CAP_PROP_FRAME_HEIGHT)
+ video_width = int(vc.get(cv2.CAP_PROP_FRAME_WIDTH))
+ video_height = int(vc.get(cv2.CAP_PROP_FRAME_HEIGHT))
vc.set(3, video_width) #set width
vc.set(4, video_height) #set height
@@ -104,12 +104,9 @@ def decode_video():
try:
# Initialize license.
- # The organization id 200001 here will grant you a free public trial license. Note that network connection is required for this license to work.
- # If you want to use an offline license, please contact Dynamsoft Support: https://www.dynamsoft.com/company/contact/
+ # The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work.
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python
- para = BarcodeReader.init_dls_connection_parameters()
- para.organization_id = "200001"
- error = BarcodeReader.init_license_from_dls(para)
+ error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])