-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85c3f0e
commit a8eb9c8
Showing
57 changed files
with
979 additions
and
1,788 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,196 +1,57 @@ | ||
# Welcome to Dynamsoft Barcode Reader - Python Edition | ||
# Dynamsoft Barcode Reader samples for Python edition | ||
|
||
[![Current version number](https://img.shields.io/pypi/v/dbr?color=orange)](https://pypi.org/project/dbr/) | ||
[![Supported Python versions](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue)](https://www.python.org/downloads/) | ||
[![PyPI downloads](https://img.shields.io/pypi/dm/dbr)](https://pypistats.org/packages/dbr) | ||
|
||
![Dynamsoft](https://dynamsoft.github.io/styleguide/assets/images/icons/dynamsoft_logos/dynamsoft_logo_original.png "Dynamsoft") | ||
|
||
## What You Should Know | ||
- [![](https://img.shields.io/badge/Download-Offline%20SDK-orange)](https://www.dynamsoft.com/barcode-reader/downloads) | ||
- [![](https://img.shields.io/badge/Get-30--day%20FREE%20Trial%20License-blue)](https://www.dynamsoft.com/customer/license/trialLicense/?product=dbr) | ||
|
||
**[Dynamsoft's Barcode Reader SDK](https://www.dynamsoft.com/barcode-reader/overview/?utm_source=github) enables you to efficiently embed barcode reading functionality in your web, desktop or mobile application using just a few lines of code. Saving you months of added development time and resources, our SDK can create high-speed and reliable barcode scanner software applications to meet your business needs.** | ||
|
||
## Dynamsoft Barcode Reader - Python Edition | ||
|
||
*Dynamsoft Barcode Reader's Python Edition comes with all the general features of Dynamsoft Barcode Reader, bringing convenience for customers who develop in Python. In addition, you could refer to the Python samples available in our [Github](https://github.com/dynamsoft-dbr/python-barcode) when building your own application. If you have any inquiries about our product, please contact us at [email protected]. If you need more information, please check out our [documentation site](https://www.dynamsoft.com/barcode-reader/programming/python/?utm_source=github).* | ||
|
||
## Table Of Contents | ||
- [Version](#version) | ||
- [Supported Python Version](#supported-python-version) | ||
- [Supported Platforms](#supported-platforms) | ||
- [Installation](#installation) | ||
- [Supported Symbologies](#supported-symbologies) | ||
- [Release Notes](#release-notes) | ||
- [Interfaces](#interfaces) | ||
- [Enumerations](#enum-interfaces) | ||
- [Classes](#Classes) | ||
- [Main Class Interface](#main-class-interface) | ||
- [Appendix](#appendix) | ||
- [Code Snippet](#code-snippet) | ||
- [Contact Us](#contact-us) | ||
## Overview | ||
|
||
### Version | ||
This repository contains multiple samples that demonstrates how to use the [Dynamsoft Barcode Reader](https://www.dynamsoft.com/barcode-reader/overview/) Python Edition. | ||
|
||
- **8.6** | ||
## Requirements | ||
|
||
### Supported Platforms | ||
- **Windows x64** | ||
- Windows x64 | ||
- Linux(x64, ARM32, ARM64) | ||
- macOS(10.15+) | ||
|
||
- **Linux(x64, ARM32, ARM64)** | ||
### Supported Python Versions | ||
|
||
- **macOS(10.15+)** | ||
- Python3.6 | ||
- Python3.7 | ||
- Python3.8 | ||
- Python3.9 | ||
|
||
### Supported Python Versions | ||
## Installation | ||
|
||
- **Python3.6** | ||
>**pip install dbr** or **pip3 install dbr** | ||
- **Python3.7** | ||
## Samples | ||
|
||
- **Python3.8** | ||
| Sample Name | Description | | ||
| ----------- | ----------- | | ||
| `hello-world` | This is a python sample that illustrates the simplest way to recognize barcodes from images with Dynamsoft Barcode Reader SDK. | | ||
| `general-settings` | This is a python sample that illustrates how to make general settings (including barcode format/barcode count/scan region) when using Dynamsoft Barcode Reader. | | ||
| `image-decoding` | This is a python sample that illustrates how to decode images in various format (including file bytes/opencv image/image raw buffer) when using Dynamsoft Barcode Reader. | | ||
| `video-decoding` | This is a python sample that illustrates how to decode video from a file or camera when using Dynamsoft Barcode Reader. | | ||
| `video-decoding-for-picamera` | This is a python sample that illustrates how to decode videos from PiCamera in the Raspberry Pi when using Dynamsoft Barcode Reader. | | ||
| `batch-decode` | This is a python sample that shows how to decode image files in a specified folder. | | ||
| `speed-first-settings` | This is a python sample that shows how to configure Dynamsoft Barcode Reader to read barcodes as fast as possible. The downside is that read-rate and accuracy might be affected. | | ||
| `read-rate-first-settings` | This is a python sample that shows how to configure Dynamsoft Barcode Reader to read as many barcodes as possible at one time. The downside is that speed and accuracy might be affected. It is recommended to apply these configurations when decoding multiple barcodes from a single image. | | ||
| `accuracy-first-settings` | This is a python sample that shows how to configure Dynamsoft Barcode Reader to read barcodes as accurately as possible. The downside is that speed and read-rate might be affected. It is recommended to apply these configurations when misreading is unbearable. | | ||
| `read-dpm-barcode` | This is a python sample that shows how to configure Dynamsoft Barcode Reader to read DPM barcodes. | | ||
|
||
- **Python3.9** | ||
## Documentation | ||
|
||
### Installation | ||
https://www.dynamsoft.com/barcode-reader/programming/python/?ver=latest&utm_source=samples | ||
|
||
>**pip install dbr** or **pip3 install dbr** | ||
## 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) | ||
|
||
## Contact Us | ||
|
||
### Supported Symbologies | ||
*We support all major barcodes symbologies across a variety of industries such as government, finance, retail, warehouse inventory, and healthcare.* | ||
|
||
- **Linear Barcodes (1D)** : | ||
- Code 39 *(including Code 39 Extended)* | ||
- Code 93 | ||
- Code 128 | ||
- Codabar | ||
- Interleaved 2 of 5 | ||
- EAN-8 | ||
- EAN-13 | ||
- UPC-A | ||
- UPC-E | ||
- Industrial 2 of 5 | ||
- MSI Code | ||
- **2D Barcodes** : | ||
- QR Code *(including Micro QR Code)* | ||
- Data Matrix | ||
- PDF417 *(including Micro PDF417)* | ||
- Aztec Code | ||
- MaxiCode *(mode 2-5)* | ||
- **Patch Code** | ||
- **GS1 Composite Code** | ||
- **GS1 DataBar** : | ||
- Omnidirectional | ||
- Truncated | ||
- Stacked | ||
- Stacked Omnidirectional | ||
- Limited | ||
- Expanded | ||
- Expanded Stacked | ||
- **Postal Codes** : | ||
- USPS Intelligent Mail | ||
- Postnet | ||
- Planet | ||
- Australian Post | ||
- UK Royal Mail | ||
|
||
### Release Notes | ||
|
||
https://www.dynamsoft.com/barcode-reader/programming/python/?ver=latest&utm_source=github#release-notes | ||
|
||
### Interfaces | ||
|
||
#### Enumerations | ||
https://www.dynamsoft.com/barcode-reader/programming/python/api-reference/?ver=latest&utm_source=github#enumerations | ||
|
||
#### Classes | ||
https://www.dynamsoft.com/barcode-reader/programming/python/api-reference/?ver=latest&utm_source=github#classes | ||
|
||
#### Main Class Interface | ||
https://www.dynamsoft.com/barcode-reader/programming/python/api-reference/?ver=latest&utm_source=github#barcodereader-methods | ||
|
||
### Appendix | ||
|
||
#### Code Snippet | ||
|
||
``` | ||
import os | ||
import sys | ||
import cv2 | ||
import json | ||
from typing import List | ||
from dbr import * | ||
# you can replace the following variables' value with yours. | ||
license_key = "Input your own license" | ||
#license_server = "Input the name/IP of the license server" | ||
json_file = r"Please input your own template path" | ||
image = r"Please input your own image path" | ||
## The code snippet below shows how to use the full license in DBR 8.x: | ||
# connection_paras = BarcodeReader.init_lts_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_lts(connection_paras) | ||
# if error[0] != EnumErrorCode.DBR_OK: | ||
# print(error[1]) | ||
# except BarcodeReaderError as bre: | ||
# print(bre) | ||
reader = BarcodeReader() | ||
reader.init_license(license_key) | ||
#reader.init_license_from_server(license_server, license_key) | ||
#license_content = reader.output_license_to_string() | ||
#reader.init_license_from_license_content(license_key, license_content) | ||
error = reader.init_runtime_settings_with_file(json_file) | ||
if error[0] != EnumErrorCode.DBR_OK: | ||
print(error[1]) | ||
if sys.version_info.major == 3 and sys.version_info.minor >= 6: | ||
try: | ||
text_results:List[TextResult] = reader.decode_file(image) | ||
if text_results != None: | ||
for text_result in text_results: | ||
print("Barcode Format : ") | ||
print(text_result.barcode_format_string) | ||
print("Barcode Text : ") | ||
print(text_result.barcode_text) | ||
print("Localization Points : ") | ||
print(text_result.localization_result.localization_points) | ||
print("Exception : ") | ||
print(text_result.exception) | ||
print("-------------") | ||
except BarcodeReaderError as bre: | ||
print(bre) | ||
else: | ||
try: | ||
text_results = reader.decode_file(image) | ||
if text_results != None: | ||
for text_result in text_results: | ||
print("Barcode Format : ") | ||
print(text_result.barcode_format_string) | ||
print("Barcode Text :") | ||
print(text_result.barcode_text) | ||
print("Localization Points : ") | ||
print(text_result.localization_result.localization_points) | ||
print("Exception : ") | ||
print(text_result.exception) | ||
print("-------------") | ||
except BarcodeReaderError as bre: | ||
print(bre) | ||
``` | ||
|
||
### Contact Us | ||
<[email protected]> | ||
https://www.dynamsoft.com/company/contact/ |
Oops, something went wrong.