HowTo - PPilger/text-detection GitHub Wiki
This howto describes how to parameterize a new image.
- Create a new class that implements the interface
TextDetector
. - Implement the method
getName
to return the name of the map. The name is used for the output files. - Implement the method
getImage
to return the images you are working with. You may have more than one image if you detect different types of text seperately. - Implement the method
getFeatures
to return the feature sets you are working with. As with the images you might have more of them (for each image). - Implement all other methods with an empty body.
- Create object variables for your image(s) and feature set(s) and initialize them in the constructor.
- Register your
TextDetector
in the main method in the classTextDetection
by initializing the detector variable with your new class.
Three TextDetector
classes are already implemented as examples:
BritishIsles
, Mooskirchen
and PortolanAtlas
You can get general information about image processing [here](Image Processing).
- Create a new ImageDisplay so you are able to display your interim results. You may create several displays to compare several different images at once.
- The first step in processing is to create a binary image. For this you should use a
BackgroundProcessor
. - All further steps are up to you.
To process an image you should use the method <image>.process(...)
. The parameters and how to set them is described on the page of the processor.
There are several types of images stored in an Image
object. Use the display to display one of them.
- Use 'getImg' to get the binary image. It is input and output for all image processors.
- Use 'getColor' to get the original color image.
- Use 'getGray' to get the grayscale image of the original.
Should be removed in the next step feature detection. If this is not possible or delivers bad results use:
-
PerimeterProcessor
,ThicknessProcessor
orSkelettonProcessor
-
FirstDerivativeProcessor
orSecondDerivativeProcessor
(too large objects only)
Use ChromaticityProcessor
.
Use DensityProcessor
or LineSegmentsProcessor
in combination with EraseProcessor
. For the latter one you will have to copy the image and maybe do a seperate processing for it.
Use CloseProcessor
or DilateProcessor
.
You can get general information about feature detection [here](Feature Detection).
- Create a new 'ContourFeatureDetector' and invoke the method
findFeatures
. - To test your parameters run the program and look at the output file (<output of getName()>.jpg).
- Add rules to the detector (bevore invoking the method
findFeatures
) to remove invalid objects and test them like in step 2.
You can get general information about feature linking [here](Feature Linking).
- Create a new 'BestDirectionFeatureLinker' and invoke the method
link
. Store the return value in your feature set. - Add rules to the linker (bevore invoking the method
link
). - To test your parameters run the program and look at the output file (<output of getName()>.jpg).
Remove all features from your feature set(s) that are no text. This can be done using [feature rules] (FeatureRule).
If you have more than one feature set, you can merge them here, using the merge
method of FeatureSet
.