Leaper Vision Toolkit
中文 / English 2.x
Public Member Functions | Properties
ILOCRResult Interface Reference

This interface represents a OCR result instance and is used to access its properties. More...

Inheritance diagram for ILOCRResult:
ILObjects ILObject LOCRResult

Public Member Functions

int CountChar ()
 
int CountLine ()
 
void Draw (HDC hdc, int lineIndex, int charIndex, LPVOCRDrawFlags drawFlags, double zoomX, double zoomY, double panX, double panY)
 
void DrawAll (HDC hdc, LPVOCRDrawFlags drawFlags, double zoomX, double zoomY, double panX, double panY)
 
double GetCharHeightMetric (LPVAggregation aggType)
 
double GetCharSpaceMetric (LPVAggregation aggType)
 
double GetCharWidthMetric (LPVAggregation aggType)
 
double GetLineSpaceMetric (LPVAggregation aggType)
 
ILOCRCharItemChar (int index)
 
ILOCRLineItemLine (int index)
 
- Public Member Functions inherited from ILObjects
int Count ()
 
BOOL Empty ()
 
ILObjectItemObject (int objIndex)
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Properties

LString String [get]
 The recognition result. For multi-line result, the string is merged by line break '\n'.
 

Detailed Description

This interface represents a OCR result instance and is used to access its properties.

Usually you get the LOCRResult object from the segmentation or recognition. You can then use this interface to access to the details such as the per-line or per-character result, and draw the result on graphics windows.

Example Code

Member Function Documentation

◆ CountChar()

int CountChar ( )

Get count of the characters in the result

See also
ItemChar()

◆ CountLine()

int CountLine ( )

Get count of the lines in the result

See also
ItemLine()

◆ Draw()

void Draw ( HDC  hdc,
int  lineIndex,
int  charIndex,
LPVOCRDrawFlags  drawFlags,
double  zoomX,
double  zoomY,
double  panX,
double  panY 
)

Draw part of the OCR result onto provide device context.

Parameters
[in]drawFlagsControl the drawing behavior, see LPVOCRDrawFlags
[in]lineIndexThe index of the line to drawn
[in]charIndexThe index of the character to drawn, pass in negative value to draw the whole line
See also
DrawAll()
Use Draw Functions
Remarks
This function is currently not available on Linux / MacOS platform.

◆ DrawAll()

void DrawAll ( HDC  hdc,
LPVOCRDrawFlags  drawFlags,
double  zoomX,
double  zoomY,
double  panX,
double  panY 
)

Draw the OCR result onto provide device context.

Parameters
[in]drawFlagsControl the drawing behavior, see LPVOCRDrawFlags
See also
Draw()
Use Draw Functions
Remarks
This function is currently not available on Linux / MacOS platform.

◆ GetCharHeightMetric()

double GetCharHeightMetric ( LPVAggregation  aggType)

Calculate the aggregated metric based on the heights of all the characters in the result, for example, maximum height.

Parameters
[in]aggTypeAggregation type, see LPVAggregation for usage.
Return values
valReturn the aggregated metric.
See also
GetCharWidthMetric(), GetCharSpaceMetric()

◆ GetCharSpaceMetric()

double GetCharSpaceMetric ( LPVAggregation  aggType)

Calculate the aggregated metric based on the spaces between the characters for all the characters in the result, for example, averaging space.

Parameters
[in]aggTypeAggregation type, see LPVAggregation for usage.
Return values
valReturn the aggregated metric.
See also
GetCharWidthMetric(), GetCharHeightMetric(), GetLineSpaceMetric()

◆ GetCharWidthMetric()

double GetCharWidthMetric ( LPVAggregation  aggType)

Calculate the aggregated metric based on the widths of all the characters in the result, for example, averaging width.

Parameters
[in]aggTypeAggregation type, see LPVAggregation for usage.
Return values
valReturn the aggregated metric.
See also
GetCharHeightMetric(), GetCharSpaceMetric()

◆ GetLineSpaceMetric()

double GetLineSpaceMetric ( LPVAggregation  aggType)

Calculate the aggregated metric based on the spaces between the lines in the result, for example, averaging space.

Parameters
[in]aggTypeAggregation type, see LPVAggregation for usage.
Return values
valReturn the aggregated metric.
See also
GetCharSpaceMetric()

◆ ItemChar()

ILOCRChar* ItemChar ( int  index)

Fetch one character with given index. For multi-line result, the characters are ordered firstly by lines then by its index in line.

Parameters
[in]indexThe input index, it should be a 0-based number smaller than total count.
Return values
resultReturn the character object of given index.
See also
CountChar()

◆ ItemLine()

ILOCRLine* ItemLine ( int  index)

Fetch one line of text with given index.

Parameters
[in]indexThe input index, it should be a 0-based number smaller than total count.
Return values
resultReturn the line of text of given index.
See also
CountLine()