Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, January 25, 2019 4:22:53 PM(UTC)

Nick  
Nick

Groups: Registered, Tech Support, Administrators
Posts: 163

Was thanked: 9 time(s) in 9 post(s)

The LEADTOOLS SDK uses OcrZones to define regions of interest. Behind the scenes, they are converted into NativeOcrZone structures specific to the engine being used. It is not possible to directly add a NativeOcrZone. However, generated NativeOcrZones can be extracted and modified.

Here's a code snippet that shows how to access a NativeOcrZone, modify one of its properties, and re-insert it back into the collection:

Code:

         using (IOcrEngine engine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false))
         {
            engine.Startup(null, null, null, null);

            IOcrPage page = engine.CreatePage(inputImage, OcrImageSharingMode.None);

            // insert a new zone
            page.Zones.Add(new OcrZone() { Bounds = new LeadRect(0, 0, 100, 100)});

            // extract the NativeOcrZone at index 0 (the OcrZone we just added)
            NativeOcrZone nativeZone = engine.ZoneManager.GetNativeZone(page, 0);

            // change one of its properties
            nativeZone.RecognitionModule = NativeOcrZoneRecognitionModule.DotMatrix;

            // insert the zone back into its original index
            engine.ZoneManager.SetNativeZone(page, 0, nativeZone);


            page.Recognize(null);
            engine.Shutdown();
         }


Here's our documentation links for the GetNativeZone() and SetNativeZone() methods.
https://www.leadtools.com/help/leadtools/v20/dh/fo/iocrzonemanager-getnativezone.html
https://www.leadtools.com/help/leadtools/v20/dh/fo/iocrzonemanager-setnativezone.html

Do note that for a vast majority of OCR operations using the OcrZone structure is sufficient and accessing the NativeOcrZones is not necessary.

However, this demonstrates a way to accommodate edge cases where it's necessary to access lower-level properties that aren't immediately exposed, such as the NativeOcrZoneRecognitionModule as detailed. For more information, see our overview on Recognition Modules:
https://www.leadtools.com/help/leadtools/v20/dh/to/an-overview-of-ocr-recognition-modules-for-the-leadtools-ocr-module-omnipage-engine.html
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.041 seconds.