protected class KNNCharacterClassifier.ImageTrainer extends Object implements FontSimulator.FontSimListener<FImage>
FontSimulator.FontSimListener
implementation that receives
each character as an image in some randomised font. When it receives
an image, it creates the feature vector by calling
KNNCharacterClassifier.getImageVector(FImage)
and stores that
into a double array that can be used as input to the nearest neighbour
classifier for training. That array can be retrieved using
getVector()
.Constructor and Description |
---|
ImageTrainer(int n)
Constructor that takes the size of the output vector (that is the
total number of training instances).
|
Modifier and Type | Method and Description |
---|---|
double[][] |
getVector()
Retrieve the set of training data as a double array.
|
void |
imageCreated(FImage img)
Implementation of the
FontSimulator.FontSimListener interface. |
public ImageTrainer(int n)
n
- The number of training instancespublic void imageCreated(FImage img)
FontSimulator.FontSimListener
interface.imageCreated
in interface FontSimulator.FontSimListener<FImage>
img
- The character image.public double[][] getVector()