Skip to content
Java library for identifying Japanese characters from images
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings Eclipse settings Dec 9, 2019
data Cache files Dec 9, 2019
deploy Javadoc Dec 15, 2019
how it works How it works Dec 15, 2019
javadoc Moved javadoc creation to separate ant target Dec 15, 2019
lib Libraries Dec 9, 2019
src/net/kanjitomo Source code Dec 15, 2019
test Test syntax definition Dec 9, 2019
.classpath Project files Dec 9, 2019
.gitignore Project files Dec 9, 2019
.project Project files Dec 9, 2019
LICENSE.txt Updated html links to render properly. Dec 15, 2019
build.xml Moved javadoc creation to separate ant target Dec 15, 2019



KanjiTomo OCR is a Java library for identifying Japanese characters from images. The algorithm used in this library is custom made, originally used with KanjiTomo program: Description of the algorithm is here.

This library is intented to be used with interactive programs where user can point to individual words with a mouse. Batch-processing whole pages is not supported.


  • Include KanjiTomoOCR.jar to your project
  • Add "--illegal-access=deny" JVM parameter, this is not strictly required but prevents unnecessary warnings on startup
  • "-Xmx1200m" and "-server" JVM parameters are also recommended for performance reasons


  • Create KanjiTomo class instance
  • Load data structures with loadData method. This needs to be done only at startup.
  • Set the target image with setTargetImage method. This can be whole page or screenshot around target word. Screenshots around cursor can be taken with Java's Robot class.
  • Start OCR with runOCR method. Point argument determines the first character to be scanned in target image's coordinates and should correspond to mouse cursor location.
  • Results are returned as OCRResults object. bestMatchingCharacters field contains a list of identified characters and words list contains results of a dictionary search from these characters.


KanjiTomo tomo = new KanjiTomo();
File testImageFile = new File("file.png");
BufferedImage image =;
OCRResults results = tomo.runOCR(new Point(80,40));


KanjiTomo is free to use for non-commercial purposes. License file is here


KanjiTomo has been created by Sakari Kääriäinen. You can contact me at kanjitomo(at)


EDICT, ENAMDICT and KANJIDIC dictionaries are the property of the Electronic Dictionary Research and Development Group, and are used in conformance with the Group's licence.

imgscalr library by Riyad Kalla

Unsharp Mask code by Romain Guy

Kryo library by EsotericSoftware

You can’t perform that action at this time.