Nicomsoft OCR: Developer's Guide


Blk_GetCharRect


Syntax

C++:int Blk_GetCharRect(HBLK BlkObj, int LineIndex, int WordIndex, int CharIndex, int* Xpos, int* Ypos, int* Width, int* Height)
C#:int Blk_GetCharRect(int BlkObj, int LineIndex, int WordIndex, int CharIndex, out int Xpos, out int Ypos, out int Width, out int Height)
Visual Basic:Function Blk_GetCharRect(ByVal BlkObj As Integer, ByVal LineIndex As Integer, ByVal WordIndex As Integer, ByVal CharIndex As Integer, ByRef Xpos As Integer, ByRef Ypos As Integer, ByRef Width As Integer, ByRef Height As Integer) As Integer
Java:int Blk_GetCharRect(HBLK BlkObj, int LineIndex, int WordIndex, int CharIndex, NSInt Xpos, NSInt Ypos, NSInt Width, NSInt Height)
Delphi: function Blk_GetCharRect(BlkObj:HBLK; LineIndex:integer; WordIndex:integer; CharIndex:integer; out Xpos:integer; out Ypos:integer; out Width:integer; out Height:integer):integer


Description

Retrieves the size and position of the specified character. Use the Blk_GetLineCnt function to get the total number of text lines in the block. Use the Blk_GetWordCnt function to get the total number of words in the specified line. Use the Blk_GetCharCnt function to get the total number of characters in the specified word.


Parameters

BlkObj [IN] – the Block object. You can also specify the Image object if you want to work with the global list of text lines for the entire image.
LineIndex [IN] – the index of the text line; 0 – the first line.
WordIndex [IN] – the index of the word in the specified text line; 0 – the first word.
CharIndex [IN] – the index of the character in the specified word; 0 – the first character.
Xpos [OUT] – the address of the variable that will get the X coordinate of the character’s top-left corner, in pixels.
Ypos [OUT] – the address of the variable that will get the Y coordinate of the character’s top-left corner, in pixels.
Width [OUT] – the address of the variable that will get the width of the character, in pixels.
Height [OUT] – the address of the variable that will get the height of the character, in pixels.


Return value

Zero if success, otherwise an error code.


Remarks

The OCRSTEP_OCR step must be executed before calling this function. For the best recognition quality, the rescaling and deskewing algorithms are applied to the original image at the OCRSTEP_PREFILTERS step. This function returns the position and size for the final image. To get the position/size for the original image, use the Img_CalcPointPosition function to convert coordinates.


Example

See the sample code for the Blk_GetCharCnt function.