Dev Center
Swift
Objective-C
Table of contents

Decode from Video Sample - Use DynamsoftCameraEnhancer as Image Source

This sample illustrates how to recognize barcodes from the video streaming. In this sample, you can read how to use DynamsoftCameraEnhancer to capture the video streaming.

View the sample code

There are some basic concepts that are helpful on understanding the SDK.

CaptureVisionRouter

CaptureVisionRouter is a router that responsible for retrieving images from the source, coordinating the image processing tasks and dispatching the processing results. To implement a barcode decoding task, what you have to do are:

  • Set a standard input for your CaptureVisionRouter instance.
  • Set a result receiver via your CaptureVisionRouter instance.
  • Tell your CaptureVisionRouter instance to start working and specify a barcode decoding template with its name.
  • (Additional) Configure the image processing Parameters to optimize the barcode decoding performance.

Standard Input

Use the setInput method of the CaptureVisionRouter to bind an ImageSourceAdapter (ISA) instance is the simplest way to access to the standard input. CameraEnhancer is one of the official implementation of the ISA for you to quickly set up the mobile camera as the image source.

Output

To get the output result, you have to implement the CapturedResultReceiver and bind it with your CaptureVisionRouter instance. You will receive the barcode decoding results in the onDecodedBarcodesReceived method each time when a image (video frame) is processed.

Control the Start & Stop of the Capturing

If only one barcode decoding result is required in one scan, you can stop the barcode decoding thread via stopCapturing method. You can call the startCapturing at any time when you want to restart the barcode decoding.

  • Java
  • Kotlin
  1. @Override
    public void (DecodedBarcodesResult result) {
    if (result != null && result.getItems() != null && result.getItems().length > 0){
        runOnUiThread(() -> mRouter.stopCapturing());
    }
    }
    
  2. override fun onDecodedBarcodesReceived(result: DecodedBarcodesResult) {
    if (result?.items != null && result.items.isNotEmpty()) {
        runOnUiThread { mRouter.stopCapturing() }
    }
    }
    

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 10.x
    • Version 10.2.1101
    • Version 10.2.1100
    • Version 10.2.1101
    • Version 10.2.10
    • Version 10.0.21
    • Version 10.0.20
    • Version 10.2.10
    • Version 10.0.21
    • Version 10.0.20
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.20
    • Version 9.6.11
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.11
    • Version 9.2.10
    • Version 9.0.2
    • Version 9.0.1
    • Version 9.0.0
    • Version 9.6.40
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.13
    • Version 9.2.10
    • Version 9.0.2
    • Version 9.0.1
    • Version 9.0.0
  • Version 8.x
    • Version 8.9.3
    • Version 8.9.1
    • Version 8.9.0
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.1
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
    • Version 8.9.3
    • Version 8.9.1
    • Version 8.9.0
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.1
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
    • Version 7.6.0
    • Version 7.5.0
  • Documentation Homepage
Change +