Image Processing - PPilger/text-detection GitHub Wiki
The target of the image processing step is to create a binary image where the text can be extracted easily. The optimum would be if
- all objects that are no letters or words were removed
- every letter is one object
In my implementation the image processing is done by objects of the type ImageProcessor
.
Creating the binary image
The first part of the image processing is to create a binary image out of the original, as most of the following processing steps require a binary image as input.
Approach 1: color value validation
In this approach the image is converted to a binary image by setting a certain range of color values to white and everything else to black.
Evaluation
This approach needs a lot of additional processing to remove undesired objects from the binary image. So there are a lot of parameters to adjust for each map.
Implementation
BinaryProcessor
(based on the grayscale image)BinaryColorProcessor
(based on the color image)
Approach 2: removing the image background
In this approach the color difference of the image background and the image itself is calculated and converted to a binary image (a certain range is set white, the rest black).
Evaluation
This approach delivers quite good results without the need for much additional processing. As a result there are only a view parameters needed to configure the processing step.
The performance however is worse than approach 1 in the two test maps "Mooskirchen" and "British Isles".
Implementation
BackgroundProcessor
Improving the image
There are several processors that can be used to improve the image.
Defining a value range for certain attributes
ChromaticityProcessor
DensityProcessor
FirstDerivativeProcessor
PerimeterProcessor
SecondDerivativeProcessor
ThicknessProcessor
(SkelettonProcessor also has the ability to restrict the thickness)
Transforming the image
LineSegmentsProcessor
(should be used in combination with EraseProcessor to remove lines in the image)MedianProcessor
SkelettonProcessor
Morphological operations
CloseProcessor
DilateProcessor
ErodeProcessor
OpenProcessor
Combining images
EraseProcessor
MaskProcessor