Zonal OCR REST Service: 25 Projects in 25 Days

Posted on 2015-10-09 Greg

Testing OCR Web Service Testing OMR Web Service Testing MICR Web Service

As part of the LEAD Technologies 25th anniversary, we are creating 25 projects in 25 days to celebrate LEAD's depth of features and ease of use. Today's project comes from Maen.

What it Does

This project extends the OCR REST service to accept multiple zones using LEADTOOLS Version 19.

Features Used

Development Progress Journal

Hello, my name is Maen and I am going to add a new method to our OCR REST service that takes the URI of a zone file (ozf) and an array of objects that contains the bounds and type of each zone.

I am going to use LEADTOOLS Document Imaging Suite SDK, because it provides me with the support of different recognition features including OCR, MICR, OMR, zoning and many other features. The main advantage (in my opinion) of using LEADTOOLS Document toolkits is saving time and effort when dealing with images and documents.

I am going to create a new method named GetTextWithPredefinedZones. This method will take the URI of a zone file (ozf) and an instance of a user-defined class named ZonesData. The ZonesData class will have two members:

  • ZonesBounds: This array of LeadRect objects that contains the bounds of each zone.
  • ZonesTypes: This array of integers contains the type of each zone. For more details about the zone types, please see the Leadtools.Forms.Ocr.OcrZoneTypeenum.

Note that this method will use the zones file (.ozf) by default even if you pass an instance of ZonesData class. If you pass an empty string to the zones file name parameter, the function will use the ZonesData instance.

I have finished adding the new method with the required classes and types based on the following online help topics:

So far, I have 5 hours total invested in modifying the OCR REST service including the coding and debugging time. I am now creating a test C# application to check the OCR service.

I successfully ran the test application and tried different images with different zones bounds and types and it worked as expected, and finally the application and OCR service are done! It took me around 8 hours to put this together, including designing, testing and debugging.

The greatest credit of completing this application belongs to my beloved tools for providing excellent features and fully tested functions that made programming much easier for me and for programmers all over the world.

Download the Project

The source code for this sample project can be downloaded from here. To run the project, extract it to the C:\LEADTOOLS 19\Examples\REST directory.

LEADTOOLS Blog

LEADTOOLS Powered by Apryse,the Market Leading PDF SDK,All Rights Reserved