Skip to content

Commit

Permalink
update to v9.6.30
Browse files Browse the repository at this point in the history
  • Loading branch information
DMGithubPublisher committed Aug 29, 2023
1 parent 3374bb3 commit cc7d1b9
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 43 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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–2022 Dynamsoft. All rights reserved.
Copyright © 2003–2023 Dynamsoft. All rights reserved.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ https://www.dynamsoft.com/barcode-reader/programming/python/?ver=latest&utm_sour

The barcode reader library requires a license to work. You can use the API `init_license` to initialize license key and activate the SDK.

These samples use a free public trial license which require network connection to function. You can request a 30-day free trial license key from <a href="https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=python" target="_blank">Customer Portal</a> which works offline.
These samples use a free public trial license which require network connection to function. You can request a 30-day free trial license key from <a href="https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python" target="_blank">Customer Portal</a> which works offline.

## Contact Us

Expand Down
10 changes: 5 additions & 5 deletions samples/general-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])

# 2.Create an instance of Barcode Reader.
reader = BarcodeReader()

reader = BarcodeReader.get_instance()
if reader == None:
raise BarcodeReaderError("Get instance failed")
# There are two ways to configure runtime parameters. One is through PublicRuntimeSettings, the other is through parameters template.
# 3. General settings (including barcode format, barcode count and scan region) through PublicRuntimeSettings
# 3.1 Obtain current runtime settings of instance.
Expand Down Expand Up @@ -59,7 +60,6 @@
print("No data detected.")

# 6.Release resource
del reader

reader.recycle_instance()
except BarcodeReaderError as bre:
print(bre)
2 changes: 1 addition & 1 deletion samples/hello-world.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
Expand Down
10 changes: 6 additions & 4 deletions samples/image-decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ def choose_number() -> int:
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])

# 2.Create an instance of Barcode Reader.
dbr = BarcodeReader()

dbr = BarcodeReader.get_instance()
if dbr == None :
raise BarcodeReaderError("Get instance failed")

# Replace by your own image path
image_path = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + "../images/AllSupportedBarcodeTypes.png"

Expand Down Expand Up @@ -87,6 +89,6 @@ def choose_number() -> int:
i = i+1
else:
print("No data detected.")

dbr.recycle_instance()
except BarcodeReaderError as bre:
print(bre)
10 changes: 6 additions & 4 deletions samples/performance/accuracy-first-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ def output_results(results:TextResult):
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])

# 2.Create an instance of Barcode Reader.
dbr = BarcodeReader()

dbr = BarcodeReader.get_instance()
if dbr == None:
raise BarcodeReaderError("Get instance failed")
# Replace by your own image path
image_path = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + "../../images/AllSupportedBarcodeTypes.png"

Expand All @@ -81,6 +82,7 @@ def output_results(results:TextResult):

# 5.b Output the barcode format and barcode text.
output_results(results)


dbr.recycle_instance()
except BarcodeReaderError as bre:
print(bre)
9 changes: 5 additions & 4 deletions samples/performance/batch-decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])

# 2.Create an instance of Barcode Reader.
reader = BarcodeReader()

reader = BarcodeReader.get_instance()
if reader == None :
raise BarcodeReaderError("Get instance failed")
# Replace by your own image path
image_folder = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + "../../images"

Expand All @@ -34,6 +35,6 @@
print("-------------")

print(40*'#')

reader.recycle_instance()
except BarcodeReaderError as bre:
print(bre)
9 changes: 5 additions & 4 deletions samples/performance/read-rate-first-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ def output_results(results:TextResult):
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])

# 2.Create an instance of Barcode Reader.
dbr = BarcodeReader()

dbr = BarcodeReader.get_instance()
if dbr == None :
raise BarcodeReaderError("Get instance failed")
# Replace by your own image path
image_path = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + "../../images/AllSupportedBarcodeTypes.png"

Expand All @@ -108,6 +109,6 @@ def output_results(results:TextResult):

# 5.b Output the barcode format and barcode text.
output_results(results)
dbr.recycle_instance()
except BarcodeReaderError as bre:
print(bre)
11 changes: 7 additions & 4 deletions samples/performance/speed-first-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ def output_results(results:TextResult):
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])

# 2.Create an instance of Barcode Reader.
dbr = BarcodeReader()

dbr = BarcodeReader.get_instance()
if dbr == None:
raise BarcodeReaderError("Get instance failed")
# Replace by your own image path
image_path = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + "../../images/AllSupportedBarcodeTypes.png"

Expand All @@ -115,6 +116,8 @@ def output_results(results:TextResult):

# 5.b Output the barcode format and barcode text.
output_results(results)


dbr.recycle_instance()

except BarcodeReaderError as bre:
print(bre)
10 changes: 6 additions & 4 deletions samples/use-case/read-dpm-barcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ def output_results(results:TextResult):
try:
# 1.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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])

# 2.Create an instance of Barcode Reader.
dbr = BarcodeReader()

dbr = BarcodeReader.get_instance()
if dbr == None:
raise BarcodeReaderError("Get instance failed")
# 3.Config runtime settings for dmp
sts = dbr.get_runtime_settings()

Expand Down Expand Up @@ -53,6 +54,7 @@ def output_results(results:TextResult):
# 4 Output the barcode format and barcode text.
output_results(results)


dbr.recycle_instance()

except BarcodeReaderError as bre:
print(bre)
15 changes: 8 additions & 7 deletions samples/video-decoding-for-picamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,17 @@ def read_barcode():

# 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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&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()
reader = BarcodeReader.get_instance()
if reader != None:
error = reader.init_runtime_settings_with_file(json_file)
if error[0] != EnumErrorCode.DBR_OK:
print(error[1])

error = reader.init_runtime_settings_with_file(json_file)
if error[0] != EnumErrorCode.DBR_OK:
print(error[1])

read_barcode()
read_barcode()
reader.recycle_instance()
print("-------------------over------------------------")
9 changes: 5 additions & 4 deletions samples/video-decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def decode_video():

windowName = "Video Barcode Reader"

reader = BarcodeReader()

reader = BarcodeReader.get_instance()
if reader == None:
raise BarcodeReaderError("Get instance failed")
parameters = reader.init_frame_decoding_parameters()
parameters.max_queue_length = 30
parameters.max_result_queue_length = 30
Expand Down Expand Up @@ -96,7 +97,7 @@ def decode_video():

reader.stop_video_mode()
cv2.destroyWindow(windowName)

reader.recycle_instance()

if __name__ == "__main__":

Expand All @@ -105,7 +106,7 @@ def decode_video():
try:
# 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
# You can also request a 30-day trial license in the customer portal: https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=python
error = BarcodeReader.init_license("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9")
if error[0] != EnumErrorCode.DBR_OK:
print("License error: "+ error[1])
Expand Down

0 comments on commit cc7d1b9

Please sign in to comment.