Dev Center
Swift
Objective-C
Table of contents

TinyBarcodeDecoding Sample

View the sample code

When processing a small-sized barcode or a barcode that is localized far away, the following factors might cause the low performance:

  • The module size of the barcode is too small.
  • The image quality of the barcode zone is too low.

TinyBarcodeDecoding is the sample to tell you how Dynamsoft Barcode Reader is designed to process the tiny barcodes.

Zoom Control

Set the Zoom Factor

Generally, control the camera to zoom-in has better effect than approaching to the target because some device have difficulty on close-up focus.

close-vs-zoom

Close-up vs camera zoom. The focus is much easier when using camera zoom.

Here is the sample code to enlarge the zoom factor:

// Import Camera Enhancer library to use the camera control module.
import com.dynamsoft.dce.CameraEnhancer;
CameraEnhancer camera = new CameraEnhancer(MainActivity.this);
// Set the zoom factor to 2 times of the initial zoom factor.
try {
   camera.setZoom(2.0f);
} catch (CameraEnhancerException e) {
   e.printStackTrace();
}

Enable Auto-zoom

Auto-zoom is another way for you to change the zoom factor. When the auto-zoom feature is enabled, the camera will zoom-in automatically when a barcode is located be not decoded. The auto-zoom-out will be triggered when barcode is decoded successfully.

auto-zoom

Close-up vs camera zoom. The focus is much easier when using camera zoom.

// Import Camera Enhancer library to use the camera control module.
import com.dynamsoft.dce.CameraEnhancer;
CameraEnhancer camera = new CameraEnhancer(cameraView, MainActivity.this);
try {
   // Enable auto-zoom feature
   camera.enableEnhancedFeatures(EnumEnhancerFeatures.EF_AUTO_ZOOM);
} catch (CameraEnhancerException e) {
   e.printStackTrace();
}

Note: A valid license is required to use auto-zoom feature.

Focus Control

Select a suitable focus mode can help you further improve the read-rate and accuracy when processing small-size barcodes.

When your device is stable, you can lock the focal length after focusing is complete.

camera.setFocus(new PointF(0.5,0.5), EnumFocusMode.FM_LOCKED);

If your device is not stable, you can replace the last line with the following code to keep the continuous auto focus mode.

camera.setFocus(new PointF(0.5,0.5), EnumFocusMode.FM_CONTINUOUS_AUTO);

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version (10.2.10)
  • Version 10.x
    • Version 10.0.21
    • Version 10.0.20
  • Version 9.x
    • Version 9.6.20
    • Version 9.6.11
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.13
    • Version 9.2.11
    • 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 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +