Free-Form Image Capture in Java

Demonstrates how to use Free-Form Image Capture to recognize and highlight barcodes within captured images.

Download Source

Product

DataWedge - 13.0

Devices

All supported Zebra Android 11 or higher devices

Overview

Free-Form Image Capture allows an image of any form (not restricted to a document or label) to be captured by either the built-in internal imager or camera with the option to highlight and/or decode any barcode present. The capability for the internal imager to capture an image is useful if there is no built-in camera on the device. When capturing images from the camera, the image resolution is 1920 x 1080.

This sample app performs the following:

  • Registers a broadcast receiver to listen for DataWedge intents.
  • Creates a DataWedge profile named "FreeFormImageCaptureProfile" if it does not exist and retrieves the result from the broadcast receiver. The profile includes the following configurations:
    • Enables Free-Form Image Capture under Workflow Input.
    • Enables Intent Output and sets the intent action, category and delivery mechanism to broadcast.
    • Associates the sample app to the "FreeFormImageCaptureProfile" profile.
  • When scanning a barcode from any image, the data is captured and displayed with the image and decoded data.

This sample application is only intended for educational purposes, demonstrating the use of DataWedge intent API(s).

Requirements

  • DataWedge 11.4 or higher

APIs Used

DataWedge API App Functionality
Create Profile Create the profile with specific parameters for Free-Form Image Capture.
Delete Profile Delete the profile if creating the profile fails.
Get Profiles List Get the list of DataWedge profiles on the device to check if a profile exists.
Set Config Set the appropriate configurations specified.
Soft Scan Trigger Start/stop or toggle the software scan trigger.

Using This Sample

  1. Download and build the sample app.

  2. Copy and install the sample app to the device.

  3. Launch the sample app.

    • DataWedge profile “FreeFormImageCaptureProfile” is created if it does not exist.
    • If profile creation fails, the profile is deleted. Tap Re-create profile to attempt to recreate the profile.
  4. Tap Start Scanning or press the hardware trigger button to start the scan.

  5. When a barcode is detected within the viewfinder, it is highlighted.

  6. Capture the image by pressing the trigger button.

    • If a barcode is detected within the image captured, the decoded data along with the captured image is displayed.
    • If no barcode is detected, only the image is displayed.
  7. Tap Clear Scan Data to clear the data displayed.


Related guides: