DataWedge OCR | What It Is and How to Control It

Darryn Campbell -

DataWedge OCR Image

By @darryncampbell

DataWedge 11.2 introduces new, powerful options to capture data with advanced "Workflows" including the ability to highlight specific barcodes in the field of view, capture images with the scanner and OCR (optical character recognition) for real world objects such as ID cards or vehicle license plates.

This is the third part of a series of posts about the new Workflows feature. Other posts can be found here:

  1. Barcode Highlighting
  2. Free-Form image capture
  3. DataWedge OCR | What it is and how to control it
  4. DataWedge OCR | Identity Documents

OCR for identity documents is handled a bit differently and will be addressed in the next post.

I have developed a sample application to demonstrate many of these features but please be aware that it is unsupported.

Documentation for OCR is spread over multiple sections on the techdocs portal:

DataWedge OCR

DataWedge 11.2 introduces the first "Early Access" version of OCR for real world objects:

  • License Plates
  • Vehicle Identification Numbers (VIN)
  • Tyre Identification Numbers (TIN)
  • Meters (digital or analog dials e.g. gas or electric meters)
  • Identification documents such as drivers licenses or national identity card.

Licensing OCR

You can experiment with all OCR features using DWDemo without obtaining any kind of license

All DataWedge OCR features delivered via the Workflow plugin require a license. Each OCR feature is licensed individually and is term-based (at the time of writing, 1 or 2 years). Please contact your Zebra reseller to obtain licenses.

DW OCR Overview

More information about licensing is available on TechDocs but in summary:

  • You obtain a license file through a Zebra reseller or, in some cases, through Zebra directly. Evaluation licenses are also available to experiment with the feature prior to purchase.
  • Apply the license. Either:
    • Download the .bin file from the license portal and deploy the file using either StageNow or your EMM
    • Use the on-device application with your license code.

Note: OCR licensing uses the same licensing mechanism used elsewhere for Zebra Android value-adds, known as Mobility DNA licensing, including entitlement for Zebra One Care customers.

OCR: License Plates, Vehicle Identification Numbers (VIN), Tyre Identification Numbers (TIN), Meters

All current OCR features, with the exception of identity documents, are handled in a consistent way by DataWedge, so this section will group them together.

For more information on DataWedge OCR, please see the Techdocs help page

Possible uses for OCR (License Plates, VIN, TIN, Meters)

Unlike standard OCR, DataWedge OCR is designed with specific use cases in mind. With knowledge of what is being scanned, it can make the recognition process quicker and more reliable.

You can include DataWedge OCR into your existing workflow. For example:

  • Returning a rental car could involve scanning the license plate and VIN rather than keying them in.
  • On-site surveys requiring meter-reading could be made more efficient and less prone to keying errors
  • Scanning the TIN will make changing tyres more efficient and less error-prone.

How to configure OCR (License Plates, VIN, TIN, Meters)

All OCR will follow some common configuration along with some special considerations depending on what is being recognized.

To configure OCR, configure your DataWedge profile as follows:

  1. Enable the Workflow input plugin. If doing this through the DataWedge UI, you will be prompted that you cannot have both the Barcode and Workflow input plugins active.
  2. Scroll down to the OCR type you want and enable it.
  3. Press the ellipsis to bring up additional parameters
  4. Under 'Input Source', only camera is supported at present
  5. Set the session timeout, in ms. This is the length of time that the scan engine will try to recognize the object in view. I recommend setting this to about 10 seconds.
  6. Set the Illumination (useful in low light conditions at the trade-off of increased battery use during recognition) and whether each scan will send an image along with the results ('Output Image').
  7. Set the Feedback Parameters, such as haptic feedback, LED notification and decode audio feedback. This is the feedback that will be given when recogition is complete.

DW OCR Config

OCR Configuration for VIN, though the options will be similar for all OCR types.

Special considerations for License Plates

Only certain country's license plates are supported. At the time of writing the majority of US states plus most EMEA countries are supported. For the most recent list of supported plates, please see TechDocs.

License plate configuration includes an additional option, Region selection, to aid recognition.

DW OCR License Plates

Special considerations for VIN

There are no additional settings for VIN. A VIN of 17 characters will be recognized, orientated horizontally or vertically. See TechDocs for more information.

Special considerations for TIN

There are three different modes that help support different tyre identification number formats. At the time of writing, we support tyres that adhere to the US DOT (department of transport) standards but international tyres will be supported in a subsequent release. For the most recent list of supported tyres, please see TechDocs.

TIN configuration includes an additional option, the standard to use in recognition.


Special considerations for Meters

All standard meter types are supported: Analog, dial and digital meter readers. For more information, see TechDocs which also includes additional restrictions for each type of meter.

To aid recognition, it is necessary to tell DataWedge whether you are scanning a dial-based meter or not:

DW OCR Meters

How to use OCR (License Plates, VIN, TIN, Meters)

  • The hardware or software trigger will initiate the data acquisition session
  • As the system performs OCR, it will highlight the area it is recognizing
  • Once recognized, the data will be returned to the calling app. Do NOT press the trigger to capture data. This differs from freeform image capture which does require you to press the trigger.
  • If nothing was recognized before the timeout, no data is sent to the calling app.

Video Demos of OCR (License Plates, VIN, TIN, Meters)

The technical and marketing teams have already gone through the effort of posting short demos for each of the OCR types to YouTube, please find these below:

OCR: License Plate

Video demonstrating OCR of a license plate through DWDemo


Video demonstrating OCR of a VIN through DWDemo


Video demonstrating OCR of a TIN through DWDemo

OCR: Meter

Video demonstrating OCR of a meter through DWDemo

Coding and OCR (License Plates, VIN, TIN, Meters): Receiving Data

Parsing OCR results is very similar to how Freeform image capture results are parsed, as explained in a previous post and the Workflow programmer's guide is the best place to start understanding either.

Most importantly for OCR, please refer to the 'OCR Result Output' section of the Workflow programmer's guide as that gives specific information about parsing the received OCR value.

License plates, VIN, TIN and meters will all return a single String data value representing the recognized value, contained within the string_data field. How you parse which value is returned can be done as follows:

//  Given the data is returned via 'intent
String data = intent.getStringExtra("com.symbol.datawedge.decode_data");
JSONArray dataArray = new JSONArray(data);
for (int i = 0; i < dataArray.length(); i++)
  JSONObject workflowObject = dataArray.getJSONObject(i);
  if (workflowObject.has("string_data"))
    if (label.equalsIgnoreCase("License Plate Number"))
      Log.d(LOG_TAG, "License Plate" + workflowObject.get("string_data"));
    else if (label.equalsIgnoreCase("VIN Number"))
      Log.d(LOG_TAG, "VIN (Vehicle Identification Number) " + workflowObject.get("string_data"));
    else if (label.equalsIgnoreCase("TIN Number"))
      Log.d(LOG_TAG, "TIN (Tyre Identification Number)" + workflowObject.get("string_data"));
    else if (label.equalsIgnoreCase("Meter Reading"))
      Log.d(LOG_TAG, "Meter (e.g. Gas meter)" + workflowObject.get("string_data"));
      //  Freeform Image capture.  Parse this as shown previously
      //  Image data.  Parse this in the same way as freeform image capture

Coding and OCR (License Plates, VIN, TIN, Meters): Configuring DataWedge

There are two ways to configure OCR in code. This section is similar to the previous blogs which talked about configuring DataWedge for barcode highlighting and freeform image capture, though some of the detail is different.

1. At Runtime:

A new API has been introduced in DataWedge 11.2 Switch Data Capture to allow you to switch from 'regular' scanning to any of the workflow input options.

The full code example in the help docs for Switch Data Capture shows how to switch to OCR (meter reading) and should be treated as the authoritative source but is summarized below:

Intent i = new Intent();
i.putExtra("APPLICATION_PACKAGE", getPackageName());
i.putExtra("com.symbol.datawedge.api.SWITCH_DATACAPTURE", "WORKFLOW");

Bundle paramList = new Bundle();
  paramList.putString("workflow_input_source","2");  //  2 is camera, 1 is imager
Bundle paramSet1 = new Bundle();
Bundle moduleAParams = new Bundle();
  moduleAParams.putString("session_timeout", "15000");
ArrayList<Bundle> paramSetList = new ArrayList<>();
paramList.putParcelableArrayList("workflow_params", paramSetList);
i.putExtra("PARAM_LIST", paramList);


2. Persistently:

A new section has been added to the existing SetConfig API for Workflow Input. The format passed to SetConfig is very similar to that passed to the new 'Switch Data Capture' API, i.e. create a nested bundle structure for rules, actions and criteria.

Important: Do not confuse the Workflow Input parameters for OCR with the OCR Parameters that apply only to the barcode input plugin and support freeform recognition of OCR_A and OCR_B typefaces.

There are dedicated examples available in TechDocs to configure OCR:

Coding and OCR (License Plates, VIN, TIN, Meters): Registering for Change

Registering for change in the workflow plugin status was covered in the earlier blogs about barcode highlighting and free-form image capture but is included here for completeness:

The RegisterForNotification API has been updated to report the status of the workflow plugin.

Register to receive the Workflow notifications. See the RegisterForNotification docs or this app for more detailed code:

Bundle b = new Bundle();
b.putString("com.symbol.datawedge.api.APPLICATION_NAME", getPackageName());
b.putString("com.symbol.datawedge.api.NOTIFICATION_TYPE", "WORKFLOW_STATUS");

Process the received notification

  Log.d(LOG_TAG, "WORKFLOW_STATUS: status: " + b.getString("STATUS");

Be aware: Any Intent API sent to DataWedge before the 'PLUGIN_READY' status will lead to undefined behaviour.

Some additional notes for OCR (License Plates, VIN, TIN, Meters)

  • Enhancements and additional features will be added to OCR in the future, so please check the official documentation for the latest feature set.
  • Additional regions and standards will be added to the product in the near future, so again, please refer to the official docs to see if your region is supported.
  • You can experiment with OCR without a license using DWDemo but evaluation licenses are also available when you need to integrate it with your app.

Darryn Campbell

Please register or login to post a reply

0 Replies