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, July 14, 2017 12:13:33 PM(UTC)

Nick  
Nick

Groups: Registered, Tech Support, Administrators
Posts: 163

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

This post is for the v19 version of LEADTOOLS. For an updated version please check here:
https://www.leadtools.com/support/forum/posts/t12482-FAQ--Parameters-passed-to-OcrEngine-Startup---in-LEADTOOLS-v20

The call to OcrEngine.Startup() accepts four parameters. Typically, the call is made as such:

Code:

ocrEngine.Startup(null, null, null, null)


This call uses default options. However, these fields can be customized based on development needs. We have information on the call and its parameters in our online documentation. This post serves as an overview and explanation.
https://www.leadtools.com/help/leadtools/v19m/dh/fo/iocrengine-startup.html

The four parameters are:

  • An instance of RasterCodecs
  • An instance of DocumentWriter
  • A string representing the work directory
  • A string representing the startup parameters


How is the RasterCodecs instance used?
If "null" is specified, a RasterCodecs instance is created internally by the engine, although some properties of the object are modified to facilitate recognition. Specifically, the XResolution and YResolution are set to 300, and the DisplayDepth is set to auto-detect. These settings are typically recommended when loading a document for OCR. A custom instance of RasterCodecs can be used as this parameter, however, it is recommended to set the XResolution and YResolution values as stated.

Code:

rasterCodecsInstance.Options.RasterizeDocument.Load.XResolution = 300 
rasterCodecsInstance.Options.RasterizeDocument.Load.YResolution = 300 
rasterCodecsInstance.Options.Pdf.Load.DisplayDepth = 0


Note that an internally created instance of RasterCodecs will be automatically disposed of by the engine, however, one passed as a parameter will not.
https://www.leadtools.com/help/leadtools/v19m/dh/to/fo-topics-ocrengineandrastercodecsdocumentwriterusage.html

How is the DocumentWriter instance used?
If "null" is specified, a DocumentWriter instance is created internally by the engine. This internally generated DocumentWriter uses default values and is disposed of automatically. An initialized DocumentWriter with custom values can be passed in and used instead if the default values are insufficient.
https://www.leadtools.com/help/leadtools/v19m/dh/fo/iocrengine-documentwriterinstance.html

What is the work directory?
The IOcrEngine creates multiple temporary files during the recognition and document generation process. The work directory specifies where those files should be created. If "null" is specified, then the engine uses %TEMP%, which is the temporary folder of the current logged in user. Note that while the engine does remove temporary files after the operation is complete, if the engine does not shut down properly, these files may persist. By specifying a directory, an application can ensure any extraneous temp files are removed and that the application has access rights to the folder.

What does the startup parameters represent?
The startup parameters represents the path on disk to the OCR engine runtime files. If "null" is used, the default path based on the selected OCR engine is used.

For OcrEngineType.Advantage:
C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime

For OcrEngineType.Professional:
C:\LEADTOOLS 19\Bin\Common\OcrProfessionalRuntime
C:\LEADTOOLS 19\Bin\Common\OcrProfessionalRuntime64

For OcrEngineType.Arabic:
C:\LEADTOOLS 19\Bin\Common\OCRArabicRuntime

Note using the default path can facilitate development of proof-of-concepts on development machines where the SDK is installed. It's highly recommended this path be changed before deployment to accommodate the directory structure generated by your application instead of creating a new folder structure just to accommodate this value.

What are the runtime files?
The runtime files are required by the OCR engine and need to be included with the application. If the runtime files are not present in the directory specified by the startup parameters, the engine will throw an exception. We have more information specifically for OCR files, including those specific to each engine type, included in our documentation on OCR Files to be Included with your Application.
https://www.leadtools.com/help/leadtools/v19m/dh/to/ocrfilestobeincludedwithyourapplication.html

Edited by moderator Wednesday, December 27, 2023 3:18:17 PM(UTC)  | Reason: Not specified

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.107 seconds.