Column Functions

Summary
Column Functions
Functions
columnCreates a new Column
columnQualityReturns a quality to use with the rectMaximalWhiteRectangles.
columnIsColumnSeparatorChecks if a Rect is a column separator.
columnGetPageColumnsFinds at maximum n_tries from the page.
columnSplitImageByColumnsSplit the image in separate column images.

Functions

column

Column *column(int x1,
int y1,
int x2,
int y2,
Column *next)

Creates a new Column

Parameters

x1x coordinate of the top-left corner
y1y coordinate of the top-left corner
x2x coordinate of the bottom-right corner
y1y coordinate of the bottom-right corner
nextthe next Column in the list.  Pass NULL to create a single Column

Returns

The new Column

columnQuality

double columnQuality(Rect *r)

Returns a quality to use with the rectMaximalWhiteRectangles.  It values tall rectangles more than wide rectangles.

Parameters

rrectangle to value

Returns

A number that represents the value of the rect.

See Also

rectMaximalWhiteRectangles

columnIsColumnSeparator

int columnIsColumnSeparator(Rect *r,
Rect *characters)

Checks if a Rect is a column separator.  This is true if the Rect height is at least 3 bigger than it’s width and if it is close enough (30 pixels) to four characters in each side.

Parameters

rRect to be tested
charactersbounding boxes of the characters in the page

Returns

1 if r is a column separator, 0 otherwise

columnGetPageColumns

Column *columnGetPageColumns(Image *img,
Rect *characters,
int n_tries,
double (*quality) (Rect *r),
int (*columnClassifier) (Rect *, Rect *))

Finds at maximum n_tries from the page.  First it finds n_tries candidates to columns using the maximal white rectangles.  Then it classifies the Rect into columns and returns the positive Rects.

Parameters

imgimage to get columns from
charactersbounding boxes of the characters in the page
n_triesnumber of rectangles to get from Maximal White Rectangles.  Usually you should put a little more than the number of columns expected.
qualityquality function to use in the white rectangles algorithm
columnClassifierfunction that classify a Rect as a column.

Returns

List of Columns in the page

See also

rectArea, rectMaximalWhiteRectangles, columnIsColumnSeparator

columnSplitImageByColumns

Image **columnSplitImageByColumns(Image *img,
Column *col,
int *n_sections)

Split the image in separate column images.

Parameters

imgimage to split
colColumns to use
n_sectionspointer to the variable that will store the number of sections generated

Returns

An array of IplImage * with the page sections and the number of sections in the variable *n_sections.

See also

rectArea, rectMaximalWhiteRectangles, columnIsColumnSeparator, columnGetPageColumns

Column *column(int x1,
int y1,
int x2,
int y2,
Column *next)
Creates a new Column
double columnQuality(Rect *r)
Returns a quality to use with the rectMaximalWhiteRectangles.
int columnIsColumnSeparator(Rect *r,
Rect *characters)
Checks if a Rect is a column separator.
Column *columnGetPageColumns(Image *img,
Rect *characters,
int n_tries,
double (*quality) (Rect *r),
int (*columnClassifier) (Rect *, Rect *))
Finds at maximum n_tries from the page.
Image **columnSplitImageByColumns(Image *img,
Column *col,
int *n_sections)
Split the image in separate column images.
Rect *rectMaximalWhiteRectangles(Rect *bound,
Rect *obstacles,
int N,
double (*quality)(Rect *r))
An implementation of the algorithm described in “T.
double rectArea(Rect *r)
Returns the area of the Rect.
Close