By default the Scandit SDK is optimized for real-time video streaming. In general, barcodes in the image will not be decoded in every frame. Instead the engine tries to skip bad frames to meet real-time processing constraints.
Single image processing use-cases, e.g. scanning a scanned or photographed document, require a specific setup.
General Recommendations
- Use a YUV or Grayscale image input format. RGB formats will be converted internally leading to a slower execution.
- Use an image resolution between 800x600 to 1920x1080. 1280x720 is recommended.
- Make sure to have an area of at least 320x160 pixels when setting a restricted code location area for barcode localization.
- Having SIMD CPU support (NEON or SSE) improves execution times.
- Pre-cropping the image is not required. The SDK can find the barcodes in the image.
- Pre-processing (filter, blur, binarize) the image is not recommended. Provide natural images.
- Very long codes require adjusting the enabled symbol counts in the symbology settings.
- Blurry decoding using a custom camera and camera lens will not perform as well as high-end iOS or Android devices. Please contact us if specific optimizations for your camera are desired.
Video Streaming Use-Case
To achieve comparable results as the high level Data Capture API, you have to create barcode specific camera control algorithms that adjust exposure and auto-focus. The ScCamera implementations currently provided do not implement this.
For scenarios where a hand held device is used to scan a single barcode, the barcode scanner preset SC_PRESET_SINGLE_CODE_HAND_HELD should be set. Among other optimizations, this preset enables Smart Scan Intention, which prevents scans in the background or during fast movement.
A frame sequence should only be restarted (see sc_recognition_context_start_new_frame_sequence) if the frame stream is discontinuous, e.g. when the camera is switched off or temporarily stopped.
Single Image Processing Use-Case
Why does scanning a single image not perform as good as scanning with the mobile phone?
- There are barcode scanner presets to improve the scan robustness for this scenario. For SDK versions before 7.0, SC_PRESET_ENABLE_SINGLE_FRAME_MODE can be set. For SDK versions 7.1 or later SC_PRESET_HIGH_EFFORT should be set.
- A new frame sequence should be started for every new input image by calling sc_recognition_context_start_new_frame_sequence.
- The input image should be uncompressed. JPEG encoded image data is often poor as it contains block artifacts.
- Try to acquire images that are as sharp as possible and don't contain motion blur.
- Disable the code duplicate filter in the session configuration.
Multi-Threading
Dynamic threading is used internally to accelerate the execution if available. The functions of the SDK library are not thread-safe. All context and scanner calls have to happen in the same thread.