#include <DLStrokeWidth.h>
Static Public Member Functions | |
static double | dlGetStrokeWidth (const DLImage &image, int minRunLength=3, float lowerThreshold=0.2, float upperThreshold=0.4) |
This class calculates the estimated stroke width based on the length of the horizontal runs in the input region's connected components. To do this the width of all runs greater then a threshold are placed on a sorted list. The average width is then computed for a subset of the runs and this is returned as the stroke width.
The selection of the distribution range to be used in computing the stroke width is intended to consider runs representing stroke widths. More specifically, the range should be chosen such that only runs that are long enough to not be due to edge effects and small enough to not be part of long horizontal strokes within a character are considered.
Definition at line 26 of file DLStrokeWidth.h.
static double DLStrokeWidth::dlGetStrokeWidth | ( | const DLImage & | image, | |
int | minRunLength = 3 , |
|||
float | lowerThreshold = 0.2 , |
|||
float | upperThreshold = 0.4 | |||
) | [static] |
Runs the stroke width calculation.
The calculation is implemented as a static method, so you do not need to instantiate a DLStrokeWidth object to call this function. Typical function calls are as follows:
DLImage i("test.tif"); double w1 = DLStrokeWidth::dlGetStrokeWidth(i); // uses default parameters double w2 = DLStrokeWidth::dlGetStrokeWidth(i, 4, 0.25, 0.45);
image | Input image. | |
minRunLength | The minimum run length to be considered in calculating stroke width. Runs beneath this threshold are not considered. The intent of this parameter is to ignore short runs that may be due to jagged horizontal edges on the characters. | |
lowerThreshold | ||
upperThreshold | The lower and upper threshold parameters specify the range of run lengths to be considered in calculating the stroke width. These are percentage values. The defaults are .2 and .4 respectively, corresponding to the 20th to 40th percentiles of histogram values being used. |