Skip to content

Latest commit

 

History

History
156 lines (125 loc) · 5.16 KB

File metadata and controls

156 lines (125 loc) · 5.16 KB

Scanbot SDK – Python on Linux/Windows

NVidia Jetson

Requires Jetpack 6.1, CUDA 12.6, and TensorRT 10.3 for GPU acceleration.

1. Install Python and OpenCV

sudo apt install -y python3-venv nvidia-opencv

2. (Optional) Install CUDA + TensorRT

Make sure you are running a supported Jetpack version:

sudo apt install -y nvidia-l4t-cuda libnvinfer10 libnvinfer-plugin10 libnvonnxparsers10

3. Create and activate a virtual environment

python3 -m venv .env --system-site-packages
source .env/bin/activate
pip install --upgrade pip setuptools wheel

3. Install the Scanbot SDK

Replace <SCANBOT_SDK_VERSION> with the actual version number of the SDK you want to install.

export SCANBOT_SDK_VERSION=<SCANBOT_SDK_VERSION>
  • On ARM64 (Raspberry Pi, Jetson Nano, etc.):

    pip install https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv${SCANBOT_SDK_VERSION}/scanbotsdk-${SCANBOT_SDK_VERSION}-py3-none-linux_aarch64.whl
  • On x86_64 (Ubuntu/Debian Desktop, Servers):

    pip install https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv${SCANBOT_SDK_VERSION}/scanbotsdk-${SCANBOT_SDK_VERSION}-py3-none-linux_x86_64.whl

5. Verify installation

python -c "import scanbotsdk"

⚡ Performance notes (Jetson)

To avoid throttling, set max GPU/CPU/memory clocks:

sudo jetson_clocks --store
sudo jetson_clocks

Restore defaults later:

sudo jetson_clocks --restore

Raspberry Pi OS, Ubuntu, Debian

1. Install Python and OpenCV

sudo apt install -y python3-venv python3-opencv

2. Create and activate a virtual environment

python3 -m venv .env --system-site-packages
source .env/bin/activate
pip install --upgrade pip setuptools wheel

3. Install the Scanbot SDK

Replace <SCANBOT_SDK_VERSION> with the actual version number of the SDK you want to install.

export SCANBOT_SDK_VERSION=<SCANBOT_SDK_VERSION>
  • On ARM64 (Raspberry Pi, Jetson Nano, etc.):

    pip install https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv${SCANBOT_SDK_VERSION}/scanbotsdk-${SCANBOT_SDK_VERSION}-py3-none-linux_aarch64.whl
  • On x86_64 (Ubuntu/Debian Desktop, Servers):

    pip install https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv${SCANBOT_SDK_VERSION}/scanbotsdk-${SCANBOT_SDK_VERSION}-py3-none-linux_x86_64.whl

4. Verify installation

python -c "import scanbotsdk"

Windows

1. Prerequisites

  • x86/x86_64 CPU
  • Python 3.6+ (32/64-bit)
  • PowerShell
  • OpenCV (only for examples)

The snippets below are written for PowerShell, not cmd.

2. Create and activate a virtual environment:

python -m venv .env --system-site-packages
. .\.env\Scripts\Activate.ps1
python -m pip install --upgrade pip setuptools wheel
python -m pip install opencv-python

3. Install the Scanbot SDK

Replace <SCANBOT_SDK_VERSION> with the actual version number of the SDK you want to install.

$SCANBOT_SDK_VERSION = "<SCANBOT_SDK_VERSION>"
  • Python x86_64 (64-bit):

    pip install https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv${SCANBOT_SDK_VERSION}/scanbotsdk-${SCANBOT_SDK_VERSION}-py3-none-win_amd64.whl
  • Python x86 (32-bit):

    pip install https://github.com/doo/scanbot-sdk-example-linux/releases/download/standalone-sdk%2Fv${SCANBOT_SDK_VERSION}/scanbotsdk-${SCANBOT_SDK_VERSION}-py3-none-win32.whl

4. Verify installation

python -c "import scanbotsdk"

Usage

The example supports five modes: scan, analyze, enhance, parse, and live.

python main.py scan <subcommand> --file <path/to/file.jpg> [--license <KEY>]
python main.py analyze <subcommand> --file <path/to/file.jpg> [--save <out.jpg>] [--license <KEY>]
python main.py enhance <subcommand> --file <path/to/file.jpg> [--save <out.jpg>] [--mask <path/to/mask.jpg>] [--license <KEY>]
python main.py parse <subcommand> --text "<input>" [--license <KEY>]
python main.py live <subcommand> --device "<device-input>" [--license <KEY>] [--preview] [--use_tensorrt]

Example

python main.py scan barcode --file images/example.jpg --license <KEY>
python main.py analyze analyze_multi_page --file files/doc.pdf --license <KEY>
python main.py analyze crop_analyze --file images/doc.jpg --save out/crop.jpg --license <KEY>
python main.py enhance straighten_document --file images/doc.jpg --license <KEY>
python main.py enhance cleanup_document --file ../../test-scripts/test-images/highlighted.png --mask ../../test-scripts/test-images/highlighted_mask_001.png --save out/cleaned.jpg --license <KEY>
python main.py parse mrz --text "P<UTOERIKSSON<<ANNA<MARIA<<<<<<" --license <KEY>
python main.py live barcode --device "0" --license <KEY>

API References

👉 Scanbot SDK Python API