Building ARM64 Barcode and QR Code Scanner on Nvidia Jetson Nano
Since from version 7.6.x, Dynamsoft Barcode Reader started to support ARM64 (Previously, ARM32 only). It is good news for developers who aim to build barcode reader app on embedded computing boards like Raspberry Pi and Nvidia Jetson Nano. In this article, I will guide you through the process of building Python and C/C++ barcode reader apps on Nvidia Jetson Nano.
The AAch64 Python and C++ Barcode SDK
The operating system running on Jetson Nano is Ubuntu 18.04 Aarch64.
Python Barcode SDK for ARM64
You can find the Aarch64 edition of Dynamsoft Barcode SDK on https://pypi.org/project/dbr/#files.
The supported Python versions include 3.6, 3.7, 3.8, 3.9 and 3.10.
To install the ARM64 barcode SDK on the Aarch64 operating system, you just need to run the command:
pip3 install dbr
Once the installation is done, you can test the package in Python3:
C++ Barcode SDK for ARM64
The ARM64 C++ barcode SDK is available for download on Dynamsoft offcial website.
License Key
Appy for a 30-day free trial license key to activate the SDK.
Using ARM64 Python Barcode SDK on Jetson Nano
To get started quickly with the Python barcode APIs, you can pull the sample code from GitHub: https://github.com/Dynamsoft/barcode-reader-python-samples.
Here are the basic steps to use the Python barcode SDK:
- Import the SDK module:
from dbr import *
- Initialize the barcode reader object:
reader = BarcodeReader()
- Set the license key to unlock the SDK:
reader.init_license("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==")
- Invoke the decoding methods:
- decode_file(): Decodes barcodes from a specified image file.
- decode_buffer(): Decodes barcodes from the memory buffer containing image pixels in defined format.
- decode_file_stream(): Decodes barcodes from an image file in memory.
- decode_buffer_manually(): Decodes barcodes from the memory buffer containing image pixels in defined format.
- Ouput the barcode and QR code results:
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("-------------")
The sample test_DecodeVideoByCamera.py demonstrates how to decode barcode and QR code from the webcam video stream in real-time. In this sample, there is no decoding method called. Instead, we use start_video_mode()
, append_video_frame()
, and stop_video_mode()
, which creates a native thread and a native frame queue to asynchronously process the CPU-intensive work.
To run the sample, you need to install opencv-python
beforehand.
pip install opencv-python
python test_DecodeVideoByCamera.py
Using ARM64 C++ Barcode SDK on Jetson Nano
For coding in C++, you can refer to the article How to Build C/C++ Barcode and QR Code Reader App on Raspberry Pi. The steps are the same. We can build and run https://github.com/yushulx/cmake-cpp-barcode-qrcode on the Jetson Nano.
git clone https://github.com/yushulx/cmake-cpp-barcode-qrcode
cd cmake-cpp-barcode-qrcode
mkdir build
cd build
cmake --build . --config release
./BarcodeReader ../images/AllSupportedBarcodeTypes.png
Resources
- Jetson Nano Developer Kit: the tutorial showing how to set up Jetson Nano and boot operating system.
- Linaro Toolchain: the cross-toolchain used to compile Dynamsoft Barcode Reader.