- Preprocessing of scanned images or photos
- Extracting data from MRZ
- Export to an external file
Scenario implementation
The code samples provided in this topic are Windows -specific.
Step 1. Loading ABBYY FineReader Engine
Step 1. Loading ABBYY FineReader Engine
To start your work with ABBYY FineReader Engine, you need to create the Engine object. The Engine object is the top object in the hierarchy of the ABBYY FineReader Engine objects and provides various global settings, some processing methods, and methods for creating the other objects.To create the Engine object, you can use the InitializeEngine function. See also other ways to load Engine object (Win).
C#
Step 2. Loading settings for the scenario
Step 2. Loading settings for the scenario
You can load the processing settings suitable for this scenario using the LoadPredefinedProfile method of the Engine object. This method uses the name of a settings profile as an input parameter. Please see Working with Profiles for more information.The settings for this scenario are available in the MachineReadableZone predefined profile:If you wish to change processing settings, use appropriate parameter objects. Please see Additional optimization for specific tasks below for further information.MRZ capture is only possible if your ABBYY FineReader Engine license supports the MRZCapture module.
- Enables detection and extraction of all text on an image (pictures, vector graphics and tables are not detected).
- Resolution and geometry correction are performed automatically.
C#
Step 3. Loading and preprocessing the document images
Step 3. Loading and preprocessing the document images
To load images to FineReader Engine, you can use the methods of these objects:To load images to the FRDocument object, do one of the following:
- FRDocument
- BatchProcessor for Linux and Windows
Linux and Windows users can learn about the advantages and disadvantages of each approach in Parallel Processing with ABBYY FineReader Engine. The current topic focuses on FRDocument .
- When creating the FRDocument object, use the CreateFRDocumentFromImage method of the Engine object.
- Add images to the created FRDocument object from file (use the AddImageFile, AddImageFileWithPassword, or AddImageFileWithPasswordCallback method).
C#
Step 4. Extracting data from MRZ
Step 4. Extracting data from MRZ
To extract data from MRZ:
- [optional] Create the MrzProcessingParams object with the help of the CreateMrzProcessingParams method of the Engine object. Set up its properties to the values you need.
- Call the ExtractMrz method of the FRPage object, passing the MrzProcessingParams object you configured in the previous step as the input parameter; for default MRZ capture settings, simply pass NULL. You will receive an MrzData object containing the parsed information from the captured MRZ.
C#
Step 5. Working with the extracted data
Step 5. Working with the extracted data
The MrzData object contains all the data extracted from the MRZ. You may access the lines of machine-readable text using the GetLine method and iterate through fields using the GetField and GetFieldByType methods. The fields of the following types are extracted:
- Document type
- Document subtype
- Issuing country
- Last name
- Given name
- Document number
- Nationality
- Birth date
- Sex
- Expiry date
- Personal number
- Optional data line 1
- Optional data line 2
C#
Step 6. Exporting the extracted data
Step 6. Exporting the extracted data
The extracted data may be saved to an XML or JSON file. To export the data with the default parameters, call the ExportToFile method of the MrzData object and pass the path to the file as an input parameter. To export the data with the user-defined parameters, call the ExportToFileEx method of the MrzData object and pass the pointer to the MrzJsonExportParams object or the MrzXmlExportParams object as an input parameter.C#
Step 7. Unloading ABBYY FineReader Engine
Step 7. Unloading ABBYY FineReader Engine
After finishing your work with ABBYY FineReader Engine, you need to unload the Engine object. To do this, use the DeinitializeEngine exported function.
C#
Required resources
You can use the FREngineDistribution.csv file to automatically create a list of files required for your application to function. For processing with this scenario, select in the column 5 (RequiredByModule) the following values: Core Core.Resources Opening Opening, Processing Processing Processing.OCR Processing.OCR, Processing.ICR Processing.OCR.NaturalLanguages Processing.OCR.NaturalLanguages, Processing.ICR.NaturalLanguages Export Export, Processing If you modify the standard scenario, change the required modules accordingly. You also need to specify the interface languages, recognition languages and any additional features which your application uses (such as, e.g., Opening.PDF if you need to open PDF files). See Working with the FREngineDistribution.csv File for further details.Additional optimization
These are the sections of the Help file where you can find additional information about setting up the parameters for the various processing stages:- Loading Engine
- Different Ways to Load the Engine Object for Windows
Describes the ways of loading Engine object in detail. - Using ABBYY FineReader Engine in Multi-Threaded Server Applications for Windows
Discusses the specifics of using FineReader Engine in server applications. - Working with Profiles
Provides detailed description of predefined and user profiles.
- Different Ways to Load the Engine Object for Windows
- Recognition
- Tuning Parameters of Preprocessing, Analysis, Recognition, and Synthesis
Customization of document processing using objects of preprocessing, analysis, recognition, and synthesis parameters.
- Tuning Parameters of Preprocessing, Analysis, Recognition, and Synthesis
- Working with the extracted data
- Machine-Readable Zone Fields
The list of fields, which may be extracted from a machine-readable zone by means of ABBYY FineReader Engine 12, and their brief descriptions. - Working with Text
Working with the recognized text, paragraphs, words, and characters. - Using Voting API
Working with words and character recognition alternatives.
- Machine-Readable Zone Fields
