LinkingRule - PPilger/text-detection GitHub Wiki

These rules enable you to define if a link between two features is valid or not. The rules can be used in [feature linking](feature linking).

Attribute based LinkingRule

Validity is determined based on certain attributes.

Usage

  • Use AreaGrowthLinkingRule if all text that should be detected has the same size. This rule benefits features that are in one line.
  • Use BoxDistanceLinkingRule if CenterDistanceLinkingRule can't be used.
  • Use CenterDistanceLinkingRule if every letters can be detected as a single feature.

For feature linking use one of the two distance based rules and, if desired, the area growth based one.

Parameter

areaGrowth

The area growth is calculated with area of the linked feature - sum of the area of the two sub features.

A reasonable maximum value is the maximum (box-) distance times the maximum height of two letters.

distance

Should be choosen as small as possible to prevent linkage with undesired objects.

FixedDirectionLinkingRule

This rule can be used to define if two features may be linked in a certain direction or not.

Usage

Use this rule if all text you want to detect is oriented in one direction.

Parameters

angle

Defines the direction of the text. The parameter has to be specified in radians.

Image coordinates are used (the origin is the top left corner). So the angle 0 is horizontally and increasing the angle equals a counterclockwise rotation.

width

Defines the valid distance of the features in the specified direction.

height

Defines the valid overlap of the features in the specified direction.