Dev Center
Swift
Objective-C
Table of contents

TinyBarcodeDecoding Sample

View the 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.

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 DynamsoftCameraEnhancer
var dce:CameraEnhancer! = nil
var dceView:CameraView! = nil
func configurationDCE() {
   dceView = CameraView(frame: self.view.bounds)
   self.view.addSubview(dceView)
   dce = CameraEnhancer.init(view: dceView)
   dce.setZoom(3.0)
}

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.

// Include DynamsoftCameraEnhancer library and initialize an instance of DCE
import DynamsoftCameraEnhancer
...
var dce:CameraEnhancer! = nil
var dceView:CameraView! = nil
...
func configurationDCE() {
   dceView = CameraView(frame: self.view.bounds)
   self.view.addSubview(dceView)
   dce = CameraEnhancer.init(view: dceView)
   dce.enableEnhancedFeatures(.autoZoom)
}

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.

// Include DynamsoftCameraEnhancer library and initialize an instance of DCE
import DynamsoftCameraEnhancer
...
var dce:CameraEnhancer! = nil
var dceView:CameraView! = nil
...
func configurationDCE() {
   dceView = CameraView(frame: self.view.bounds)
   self.view.addSubview(dceView)
   dce = CameraEnhancer(view: dceView)
   let focusPoint = CGPoint(x:0.5, y:0.5)
   dce.setFocus(focusPoint, subsequentFocusMode:EnumFocusMode.FM_LOCKEDD)
}

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

dce.setFocus(focusPoint, subsequentFocusMode: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.40
    • 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 +