Regional OCR Comments

<< Click to Display Table of Contents >>

Navigation:  OCR Module > Appendix >

Regional OCR Comments


 

PRO SDK Icon Regional OCR Comments

 


 

OCR fields are defined in PDF coordinates that begin at (0,0) (the lower left corner of pages) by default. Since version 1.0.5 it is also possible to define PDF coordinates relative to the upper left corner of pages (see PXO_FieldInputFlags for further information). The PXO_InputField structure contains the geometric definitions for this region, in addition to further OCR parameters such as the whitelist and blacklist. Coordinates are in points (1/72 inch). The fields X1,Y1 and X2,Y2 form the coordinate points below:

 

regional.ocr.image.1

Figure 1. Sample OCR Field

 

A number of default whitelist and blacklist character strings are provided in the ocrdefaults.h header file.

 

The PXO_Options field ImageFlags has a special meaning for the regional OCR that OCR_GetField and OCR_GetFields performs. This is because it rotates the sub-image that the regional rectangle specifies, as opposed to rotating the whole page. This avoids situations in which whole page rotation would result in a change in regional boundaries, but still provides the increased OCR accuracy that automatic image rotation enables.

 

The low-level functions OCRp_Field and OCRp_Page return structures that give access to OCR_SymbolBox structures. Coordinates provided in these structures refer to raster page coordinates, which are calculated from internal images used in the OCR process. These coordinates operate in a different manner from PDF page coordinates. Their origin (0,0) is the upper left corner of the page. If the Y-axis value is increased then the location moves to a point lower on the page, in a manner similar to the coordinate system that Window Device Contexts and RECT structures use:

 

regional.ocr.image.2

Figure 2. Raster Page Coordinates Example

 

The OCR_RasterPageSettings structure contains the member scalefactor, which can be used to convert from PDF page coordinates to raster page coordinates.

The OCRp_RasterRectToPDF function converts Windows/RECT structures to PDF coordinates.