Java OCR
alphaScreenshots
Description
Java OCR is a suite of pure java libraries for image processing and character recognition. Small memory footprint and lack of external dependencies makes it suitable for android development. Provides modular structure for easier deployment
Categories
License
Features
- Cross Platform
- 100% Java
- Graphical User Interface
- suitable for android
Update Notifications
User Ratings
User Reviews
-
I had no trouble using the GUI to train and analyze a simple photo of some text. I also quickly created my own code that did the same, with no UI (just a console app). Fast and easy! However, my goal is to run this on Android [as is mentioned elsewhere here - right?] but I think there's a show-stopper: JavaOCR uses AWT and ImageIO (javax.imageio, that is), neither of which are supported under Android. That said, this seems to be a quite worthwhile effort, for what it is. /rob PS - Here's a quick example of how to use this code. I created 4 training files containing images of "123456789", "ABCDE", "A" and "4", because with just the first two files, the OCR confused "A" and "4" sometimes (not surprising). The test files had "45A3" and "46B3" in them, and the code got it correct! <code> package net.robcranfill.javaocr.test; import java.awt.image.BufferedImage; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.imageio.ImageIO; import net.sourceforge.javaocr.gui.GUIController; import net.sourceforge.javaocr.gui.meanSquareOCR.TrainingImageSpec; import net.sourceforge.javaocr.ocrPlugins.mseOCR.CharacterRange; import net.sourceforge.javaocr.ocrPlugins.mseOCR.OCRScanner; import net.sourceforge.javaocr.ocrPlugins.mseOCR.TrainingImage; public class Test1 { /** * @param args - unused. */ public static void main(String[] args) { new Test1().test1(); } private void test1() { // All files are here: String imageLoc = "D:/proj/_misc/JavaOCR/test1/"; // Load 4 training files List<TrainingImageSpec> images = new ArrayList<TrainingImageSpec>(0); TrainingImageSpec tis = null; tis = new TrainingImageSpec(); tis.setFileLocation(imageLoc + "1-9-Arial.png"); tis.setCharRange(new CharacterRange('1', '9')); images.add(tis); tis = new TrainingImageSpec(); tis.setFileLocation(imageLoc + "A-E-Arial.png"); tis.setCharRange(new CharacterRange('A', 'E')); images.add(tis); tis = new TrainingImageSpec(); tis.setFileLocation(imageLoc + "A-actual-small.png"); tis.setCharRange(new CharacterRange('A', 'A')); images.add(tis); tis = new TrainingImageSpec(); tis.setFileLocation(imageLoc + "4-actual-small.png"); tis.setCharRange(new CharacterRange('4', '4')); images.add(tis); // Run the OCR on our 'test' files OCRScanner ocrScanner = new OCRScanner(); try { Map<Character, List<TrainingImage>> trainingImages = GUIController.getTrainingImageHashMap(images); ocrScanner.addTrainingImages(trainingImages); // test image 1 String targImageLoc = imageLoc + "45A3-crop-rot-inv.png"; BufferedImage targetImage = ImageIO.read(new File(targImageLoc)); String text = ocrScanner.scan(targetImage, 0, 0, 0, 0, null); System.out.printf("OCR %s: '%s'\n", targImageLoc, text); // test image 2 targImageLoc = imageLoc + "46B3-crop-rot-inv.png"; targetImage = ImageIO.read(new File(targImageLoc)); text = ocrScanner.scan(targetImage, 0, 0, 0, 0, null); System.out.printf("OCR %s: '%s'\n", targImageLoc, text); } catch (Exception e) { e.printStackTrace(); } } } </code>
-
I'm getting the same error when I try train. In the GUI, it isn't clear what values I am supposed to enter for starting and ending characters (A and Z did not work for the corresponding training images, didn't have any luck with ASCII values when I tried it either). A walkthrough with the GUI and some hints on using the code would be really helpful.
-
alguien podria decirme como puedo implementarla, la verdad soy nueva en java y no se como hacerlo, gracias por su coolaboracion
-
Easy to run javaocr
-
Excellent work.
-
very good program javaocr.