yushulx/dynamsoft-sdk-skill

capture-vision-desktop

Dynamsoft SDKs in server and desktop code with Python, .NET, Java, C++, Node.js and Electron.

ソースを見る

使い方

  1. インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
  2. 必要なツール、認証情報、対応環境を原文で確認します。
  3. 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/yushulx/dynamsoft-sdk-skill --skill capture-vision-desktop

開始前の確認

  • 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
  • スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

Capture Vision on desktop and server

Same CaptureVisionRouter, one template string per capability:

CapabilityTemplate
Barcodes / QRReadBarcodes_Default
Document boundariesDetectDocumentBoundaries_Default
Boundaries + normalizationDetectAndNormalizeDocument_Default
MRZReadPassportAndId (ReadPassport, ReadId)
Text lines / labelsRecognizeTextLines_Default

There are no ready-to-use wrappers on these platforms — the router is the only entry point.

Packages

PlatformInstall
Pythonpip install dynamsoft-barcode-reader-bundle (11.6.5000) or dynamsoft-capture-vision-bundle (3.6.5000)
.NETdotnet add package Dynamsoft.DotNet.BarcodeReader.Bundle
Javacom.dynamsoft:dbr from https://download2.dynamsoft.com/maven/dbr/jar
C++desktop installer; link DynamsoftCore, DynamsoftLicense, DynamsoftCaptureVisionRouter
Node.jsnpm i dynamsoft-capture-vision-for-node (3.6.4003) + dynamsoft-capture-vision-for-node-model
Electronthe Node.js package, run in the main process

License

  1. get_trial_license with the product (dcv for the full bundle, dbr for barcode-only) and

package: "desktop".

  1. status: "login_required" means a browser window opened — ask the user to finish the Google

sign-in, then call again; the session is reused.

  1. Put licenseKey in DYNAMSOFT_LICENSE_KEY; show only licenseKeyMasked in chat.
  2. get_license_guide with platform (python, dotnet, java, cpp, nodejs) returns the call.
LanguageInitialise once, before any router
Pythonerror_code, error_message = LicenseManager.init_license(key)
.NETLicenseManager.InitLicense(key)
JavaLicenseManager.initLicense(key)
C++CLicenseManager::InitLicense(key, error, sizeof(error))
Node.jsLicenseManager.initLicense(key)

The key is edition-scoped, not product-scoped: a cross-platform or web key covers the same code across products, while a desktop key is rejected by a browser runtime with License mismatch: Browser requested. Ask for the edition that matches where the code runs.

Python: barcode from an image

Verified end-to-end (2026-11-10) with dynamsoft-barcode-reader-bundle 11.6.5000 and dynamsoft-capture-vision-bundle 3.6.5000.

python
import os
import sys

from dynamsoft_barcode_reader_bundle import (
    CaptureVisionRouter, EnumCapturedResultItemType, EnumErrorCode, EnumPresetTemplate, LicenseManager,
)


def scan(path: str) -> list[str]:
    error_code, error_message = LicenseManager.init_license(os.environ["DYNAMSOFT_LICENSE_KEY"])
    if error_code != EnumErrorCode.EC_OK:
        raise RuntimeError(f"license failed: {error_message}")

    router = CaptureVisionRouter()
    result = router.capture(path, EnumPresetTemplate.PT_READ_BARCODES.value)
    if result.get_error_code() != EnumErrorCode.EC_OK:
        raise RuntimeError(f"capture failed: {result.get_error_string()}")

    texts = []
    for item in result.get_items():
        if item.get_type() != EnumCapturedResultItemType.CRIT_BARCODE:
            continue
        texts.append(item.get_text())          # no cast needed
    return texts


if __name__ == "__main__":
    if len(sys.argv) != 2:
        raise SystemExit("usage: python scan.py <image-or-pdf>")
    found = scan(sys.argv[1])
    print("\n".join(found) if found else "no barcodes found")

Two details that trip up generated code:

  • The import path follows the package: dynamsoft_barcode_reader_bundle for the barcode bundle,

dynamsoft_capture_vision_bundle for Capture Vision. Class names are identical.

  • Do not cast result items in Python. Current bindings return concrete BarcodeResultItem

objects; BarcodeResultItem(item) raises TypeError. .NET and Java still need the cast, C++ needs CastTo() — see references/languages.md.

Other rules that matter:

  • EnumPresetTemplate.PT_READ_BARCODES.value is the template string; passing the enum does not work.
  • Zero items is a success, not an error: report "no barcodes found".
  • A multi-page PDF or TIFF yields several results from one capture() call.

Document and MRZ on desktop

Document normalization returns two item types, depending on the template:

python
result = router.capture(path, "DetectAndNormalizeDocument_Default")
for item in result.get_items():
    if item.get_type() == EnumCapturedResultItemType.CRIT_DETECTED_QUAD:
        print(item.get_location().points)                    # corners
    elif item.get_type() == EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE:
        item.save_to_file("page.jpg")                        # or get_image_data()

MRZ uses the parsed result item; read fields by name, do not parse the zone yourself:

python
result = router.capture(path, "ReadPassportAndId")
for item in result.get_items():
    if item.get_type() != EnumCapturedResultItemType.CRIT_PARSED_RESULT:
        continue
    print(item.get_code_type())                    # MRTD_TD1_ID | MRTD_TD2_ID | MRTD_TD3_PASSPORT
    print(item.get_field_value("documentNumber"))

ReadPassport on an ID card returns nothing — default to ReadPassportAndId.

Other languages

references/languages.md carries the .NET, Java, C++ and Node.js entry points, including the exact cast rules per binding.

Pitfalls

  1. Native assets ship with the package. Do not point C++/Node builds at a CDN; keep the installed

dist/lib tree and the model files next to the executable.

  1. License before router. A router created before init_license fails in ways that look like

decode errors.

  1. Check the result's error code, not just the process exit code.
  2. Release native handles (using, try-with-resources, Release()), or long batch jobs leak.
  3. Reuse one router across a batch of images; creating a router per file is correct but slow.
  4. Electron: initialise in the main process; the renderer cannot load the native module.

Verify

  • initLicense returns the success code (check it, do not ignore it).
  • One known-good image decodes and prints text.
  • An image with no barcode prints "no barcodes found" rather than throwing.
  • A second capture() on the same router still works.

Samples

  • Python barcode: https://github.com/Dynamsoft/barcode-reader-python-samples
  • Python Capture Vision: https://github.com/Dynamsoft/capture-vision-python-samples
  • .NET: https://github.com/Dynamsoft/barcode-reader-dotnet-samples
  • Java: https://github.com/Dynamsoft/barcode-reader-java-samples
  • C++: https://github.com/Dynamsoft/barcode-reader-c-cpp-samples
  • Node.js: https://github.com/Dynamsoft/capture-vision-nodejs-samples
  • Electron: https://github.com/Dynamsoft/barcode-reader-electron-nodejs
同じリポジトリから

関連する Skills

すべての Skills
yushulx
コミュニティ

capture-vision-mobile

Dynamsoft SDKs in mobile apps. Covers barcode and QR scanning, MRZ passport and ID reading, document detection and normalization on Android, iOS, Flutter, React Native, .NET MAUI and Swift Package Manager, with licensing, camera permissions, lifecycle and the CaptureVisionRouter pipeline.

1時間の導入数
1
GitHub Stars
0
更新日
11月11日
yushulx
コミュニティ

capture-vision-web

Dynamsoft SDKs in the browser with JavaScript and TypeScript. Covers barcode and QR scanning, MRZ and passport reading, document edge detection and normalization, label text recognition, PDF input, React/Vue/Angular/Next asset paths, licensing, and the camera and cleanup pitfalls that break web capture.

1時間の導入数
1
GitHub Stars
0
更新日
11月11日
yushulx
コミュニティ

document-viewer

View, annotate, reorder and export PDFs and images in a browser with Dynamsoft Document Viewer. Covers Core licensing and init, the viewer/editViewer split, page and annotation operations, saving back to PDF, and pairing with Web TWAIN for a scan-to-edit flow.

1時間の導入数
1
GitHub Stars
0
更新日
11月11日
yushulx
コミュニティ

dynamsoft-sdk

Choose and license the right Dynamsoft SDK before writing code. Covers Barcode Reader vs Capture Vision, Web TWAIN, Document Viewer, MRZ and Document Scanner boundaries, current package versions, how to get a trial license key through the license MCP, and which implementation skill to use next.

1時間の導入数
1
GitHub Stars
0
更新日
11月11日