@Reference(type=Inproceedings, author={"Epshtein, B.","Ofek, E.","Wexler, Y."}, title="Detecting text in natural scenes with stroke width transform", year="2010", booktitle="Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on", pages={"2963","2970"}, customData={"keywords","image processing;text analysis;image operator;image pixel;natural images;natural scenes;stroke width transform;text detection;Colored noise;Computer vision;Engines;Filter bank;Geometry;Image segmentation;Layout;Optical character recognition software;Pixel;Robustness","doi","10.1109/CVPR.2010.5540041","ISSN","1063-6919"}) public class StrokeWidthTransform extends Object implements SinglebandImageProcessor<Float,FImage>
The Stroke Width Transform detects strokes and their respective widths from an image. This implementation contains a number of enhancements to improve the quality of the detected strokes, based on ideas from LibCCV implementation:
SinglebandImageProcessor.Processable<T,S extends Image<T,S>,I extends Image<?,I>>
Constructor and Description |
---|
StrokeWidthTransform(boolean direction,
CannyEdgeDetector canny)
Construct the SWT with the given Canny edge detector.
|
StrokeWidthTransform(boolean direction,
float sigma)
Construct the SWT with the given sigma for smoothing in the Canny phase
The Canny thresholds are chosen automatically.
|
StrokeWidthTransform(boolean direction,
float lowThresh,
float highThresh,
float sigma)
Construct with all Canny parameters set manually.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getDirection()
Get the direction of the SWT; true for dark on light, false for light
|
int |
getMaxStrokeWidth()
Get the maximum stroke width
|
static FImage |
normaliseImage(FImage input)
Normalise the output image of the
StrokeWidthTransform for
display. |
void |
processImage(FImage image)
Process an image.
|
void |
setDirection(boolean direction)
Set the direction of the SWT; true for dark on light, false for light
|
void |
setMaxStrokeWidth(int maxStrokeWidth)
Set the maximum stroke width
|
public StrokeWidthTransform(boolean direction, CannyEdgeDetector canny)
direction
- direction of the SWT; true for dark on light, false for light
on dark.canny
- the canny edge detectorpublic StrokeWidthTransform(boolean direction, float sigma)
direction
- direction of the SWT; true for dark on light, false for light
on dark.sigma
- the amount of initial blurringpublic StrokeWidthTransform(boolean direction, float lowThresh, float highThresh, float sigma)
direction
- direction of the SWT; true for dark on light, false for light
on dark.lowThresh
- lower hysteresis threshold.highThresh
- upper hysteresis threshold.sigma
- the amount of initial blurring.public int getMaxStrokeWidth()
public void setMaxStrokeWidth(int maxStrokeWidth)
maxStrokeWidth
- the maximum stroke widthpublic void processImage(FImage image)
ImageProcessor
Image.internalAssign(Image)
.processImage
in interface ImageProcessor<FImage>
image
- The image to process in place.public static FImage normaliseImage(FImage input)
StrokeWidthTransform
for
display. This replaces all Float.POSITIVE_INFINITY
pixels with a
value of 1, and min-max normalises all the valid stroke pixels to be
between 0 and 1.input
- the image to normalisepublic boolean getDirection()
public void setDirection(boolean direction)
direction
- the direction to set