Dev Center
Swift
Objective-C
Table of contents

TinyBarcodeDecoding Sample

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.

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

View the sample

Zoom Control

Set the Zoom Factor

Generally, control the camera to zoom-in has better effect than apporaching 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 {
   mCameraEnhancer.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(MainActivity.this);
try {
   // Enable auto-zoom feature
   mCameraEnhancer.enableFeatures(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);

Scale-up Mode

When processing a still image, you don’t have the opportunity to optimize the quality of the image. For this scenario, if you are processing a small-sized barcode, the ScaleUpMode might help you to read barcode.

The following Code Snippet shows you how to set the ScaleUpMode:

try {
   BarcodeReader barcodeReader = new BarcodeReader();
   PublicRuntimeSettings settings = barcodeReader.getRuntimeSettings();
   settings.scaleUpModes = new int[]{EnumScaleUpMode.SUM_LINEAR_INTERPOLATION, EnumScaleUpMode.SUM_NEAREST_NEIGHBOUR_INTERPOLATION};
   barcodeReader.updateRuntimeSettings(settings);
} catch (BarcodeReaderException e) {
   e.printStackTrace();
}

For more introductions about scale up mode, please read more in the Parameter-ScaleUpModes page.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article:

version 9.6.40

  • Latest version
  • Version 10.x
    • 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
Change +