Back to FabImage Library website

You are here: Start » Function Reference » Computer Vision » Optical Character Recognition » GroupRegionsByLines

GroupRegionsByLines


Header: FIL.h
Namespace: fil
Module: OCR

Splits an array of blobs by distance to computed base lines.

Syntax

C++
C#
 
void fil::GroupRegionsByLines
(
	const ftl::Array<fil::Region>& inRegions,
	const fil::Rectangle2D& inRoi,
	const ftl::Optional<fil::CoordinateSystem2D>& inRoiAlignment,
	const int inLinesCount,
	const float inLineWidth,
	const bool inRemoveOutliers,
	ftl::Array<ftl::Array<fil::Region>>& outLines,
	ftl::Array<fil::Region>& outLine0,
	ftl::Array<fil::Region>& outLine1,
	ftl::Array<fil::Region>& outLine2,
	ftl::Array<fil::Region>& outLine3,
	fil::Rectangle2D& outAlignedRoi,
	ftl::Array<fil::Segment2D>& diagLines,
	ftl::Array<fil::Rectangle2D>& diagLineRanges,
	ftl::Array<fil::Point2D>& diagRegionPoints
)

Parameters

Name Type Range Default Description
inRegions const Array<Region>& Input regions (parts of characters)
inRoi const Rectangle2D& Range of character classification
inRoiAlignment const Optional<CoordinateSystem2D>& NIL
inLinesCount const int 0 - 1 ROI is divided into inLinesCount lines
inLineWidth const float 0.0 - 1.0f Value of line range used if inRemoveOutliers is set to TRUE
inRemoveOutliers const bool False If this flag is set blobs with distance greater than inLineWidth are removed.
outLines Array<Array<Region>>& Lines in single Array
outLine0 Array<Region>&
outLine1 Array<Region>&
outLine2 Array<Region>&
outLine3 Array<Region>&
outAlignedRoi Rectangle2D&
diagLines Array<Segment2D>& Segments which indicates the position of lines
diagLineRanges Array<Rectangle2D>& Rectangles represents range of lines which are included if inRemoveOutliers is set
diagRegionPoints Array<Point2D>& Point which indicates region position

Examples

As you can see in the below picture, the filter's task is to divide the input region into several sub-regions by its placement in a line. As a result, each line represents a separate region.

Exemplary result of the filter's usage.