Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi, I would suggest you read this post How to use KNearest in java?.

To actually use it you would need a learning set for text something like this THE MNIST DATABASE of handwritten digits.

Last case is to prepare your image as a (this is for digits.png in the 1st link) thresholded 20x20 square with white digit/letter in the middle of the square.

I too struggle sometimes with lack of examples for Java. Usually the easiest is to convert Python examples.