Java OCR

Several years back, I was working on an imaging project in Java which was going to require some Optical Character Recognition (OCR) functionality. After an exhaustive search, I could find nothing to fit the bill. My requirements were:

  • Must be written in Java
  • Must be freely redistributable, with or without source code
  • Must not be proprietary
  • Must be able to recognize the fonts of various printers, even if that means that it has to be trained for each new font
  • Must be reasonably fast

I never found anything that met my requirements, so I set about developing something to fit the bill. What I ended up developing, is a generic, trainable OCR package that does a fairly decent job of decoding printed text, as long as it has been trained for the font(s) it is expected to recognize.

How it Works

This OCR engine is implemented as a Java library, along with a demo application which shows the library in action. The core concept, at the character level, is image matching with automatic position and aspect ratio correction, using a least-square-error matching algorithm. It is a very simple yet reasonably effective implementation.

The Training Phase

Training consists of the following steps:

  1. Printing out the characters which it is expected to recognize
  2. Scanning those characters into an image
  3. Cropping the image down so that it includes only the training characters
  4. Telling the OCR engine to use the resulting training image, and specifying which characters the image contains

Character Recognition

The general steps used by this OCR engine for converting a scanned document to text are:

  1. Load training images
  2. Load the scanned image of the document to be converted to text
  3. Convert the scanned image to grayscale
  4. Filter the scanned image using a low-pass Finite Impulse Response (FIR) filter to remove dust
  5. Break the document into lines of text, based on whitespace between the text lines
  6. Break each line into characters, based on whitespace between the characters; using the average character width, determine where spaces occur within the line
  7. For each character, determine the most closely matching character from the training images and append that to the output text; for each space, append a space character to the output text
  8. Output the accumulated text
  9. If there are any more scanned images to be converted to text, return to step 2

Applications

This is a generic, trainable OCR engine. By default, it knows nothing except how to (attempt to) filter/clean up dust, convert to greyscale, break the document into lines, break the lines into characters, compare each character against known characters in user-supplied training images, and output the closest matches as text.

The engine was originally written to digitize documents (or specific sections of documents) which were printed with a handful of known fonts for which it could be trained, in order to minimize the error. Digitization was not intended to be 100 percent accurate, since the digitized text was to be used mainly for searching the documents by keywords. It was intended to be used in a document imaging system.

Accuracy and Performance

With the simple documents with which it was tested, this OCR engine has compared favorably against the open-source OCR package GOCR. It translated images to text with at least comparable accuracy to GOCR, and was in the same ballpark as far as speed, if not somewhat faster than GOCR. Extensive comparisons were not performed.

Getting Started

The following instructions assume you’re running on a Linux box, with a reasonably recent version of Sun’s JDK installed. You can get the JDK at http://www.oracle.com/technetwork/java/index.html. Be sure to remove any “fake” java packages that come with your Linux distribution. If you install OpenOffice, chances are you’ll get a counterfeit GNU Java implementation which does not conform to Sun’s Java specification, and is actually quite outdated as well. Unfortunately, OpenOffice has dependencies on this package. To get rid of it, you’ll need to do something like this before installing Sun’s JDK:

    rpm -e --nodeps java-1.4.2-gcj-compat

NOTE: This may BREAK your OpenOffice installation, at least until you install the Sun JDK to replace the missing Java functionality. But hey, the OpenOffice guys should know better than to force someone to install an illegitimate Java knock-off, especially since OpenOffice is operated by Sun, who created the real Java in the first place. There’s just no excuse.

As a potential “alternative”, if you’re more skilled than I am with the Linux alternatives package, you could use it to fix up the symlinks under /etc/alternatives to point to the real JDK without uninstalling the GNU Java knock-off. However, you’d have to be careful about software updates to the GNU Java knock-off “accidentally” resetting these symlinks, thereby breaking the real JDK. What a mess. Sun should really go after these guys for creating executables with the same names as Sun’s, and purposely interfering with the distribution of Sun’s legitimite Java implementation. After all, isn’t that what Microsoft did with their fake Java implementation? Bad actions are bad, no matter who’s doing them. But I digress.

So, back to the OCR engine. When you download and unpack the tarball, you’ll have an “ocr” directory. Under it you’ll find these scripts:

    • compile – compiles the Java files into class files in the classes directory
    • createJars – creates ocr.jar from the compiled classes
    • ocrscannerdemo – demonstrates OCR functionality using any of several test images and corresponding training images

Compiling

The source code *should* already be compiled, and there should be an ocr.jar file in the top-level “ocr” directory. If so, you can proceed. If not, or if you need to rebuild after making a change to the source code, just do the following:

./compile && ./createJars

Assuming there are no errors, you’ll get freshly compiled classes and a new ocr.jar with your changes.

Running the Demos

If you look under the ocrTests directory, there are several png and jpg files. Each of these is an image which contains text, and can be used to demonstrate the functionality of the OCR engine. To test the OCR engine on an image, do something like this:

./ocrscannerdemo ocrTests/asciiSentence.png

Notice that there is also a directory named ocrTests/trainingImages. This contains the font samples that are used to train the OCR engine in the demo application, so that it can recognize the fonts that were used to create the test images in the ocrTests directory. If you look at the src/com/roncemer/ocr/OCRScannerDemo.java source file, in the loadTrainingImages() function, you’ll see that the demo app is loading up each of these training images and telling the OCR engine which character ranges are contained in each image. The OCR engine then uses these images to match against each character in the source image, in order to convert the source image into text.

Using the Code in your Program

To use the code in your own program, put ocr.jar into your classpath and follow the usage pattern which is used in the src/com/roncemer/ocr/OCRScannerDemo.java source file.

Feel free to look at the other source files, if you’re interested in the inner workings of the OCR engine. The concepts are fairly simple, yet reasonably effective.

License

I originally released this engine under the GPL license, version 2. However, I felt it would be more commercially friendly if it were re-released under the BSD license. As of may 6, 2010, I’ve created a project page on SourceForge, changed the license to BSD, and uploaded the whole thing to the SourceForge Subversion repository.

SourceForge Project Page

The new JavaOCR SourceForge project is located here: http://javaocr.sourceforge.net

Feedback

As always, I’m interested in your feedback, suggestions for improvement, use cases, success stories, or whatever.

Enjoy!

67 thoughts on “Java OCR

    1. ron Post author

      The original license was BSD. I believe we moved it to MIT. Both licenses allow commercial use, and also allow private modifications without releasing the source code to your modifications. That’s why we picked these licenses — because they are very friendly to commercial software developers, of which I am one.

      Reply
  1. Sajid Moinuddin

    Hi Ron,

    I can see the sourceforge project has further development and customized for android. Can you point me to a java code with the latest android projects where it does the training and matching in a single program like your OCRScannerDemo.java?

    Regards,
    Sajid.

    Reply
    1. ron Post author

      I have not actively been involved in the project very much since I wrote this article and released the source code on SourceForge. There are other volunteer developers who have done all of the improvements, adoption to android, etc. Konstantin Pribluda would be the one to contact with questions about that. Just post your question on the forum at SourceForge.

      Reply
  2. elipeta

    where can I download this

    When you download and unpack the tarball, you’ll have an “ocr” directory. Under it you’ll find these scripts:

    compile – compiles the Java files into class files in the classes directory
    createJars – creates ocr.jar from the compiled classes
    ocrscannerdemo – demonstrates OCR functionality using any of several test images and corresponding training images

    Reply
        1. ron Post author

          No problem. The volunteers who have taken over the project have adapted it for building using Maven. When you build the project using Maven, there should be a build target which builds the JavaDocs. If the source tarball from SourceForge is missing the JavaDocs, I recommend posting that fact on the SourceForge project page. They’re pretty good at fixing these things.

          Reply
  3. Dash

    I’m looking to do some similar to this and have mo real experiance working with Java. If you don’t mind me asking were would I start looking for intonation an building my own Ocr program. It really didn’t matter what language its in I’m just looking for the theary on how this big of programming works.

    Reply
    1. ron Post author

      Try reading the Wikipedia article on optical character recognition. There are so many different approaches to OCR, each with different benefits and drawbacks.

      Reply
  4. Josh Duncan

    Hi Ron!

    I am using this project as a basis for my graduate research project. I’m having an issue with accuracy running on a Windows 7 box. Do you have any tips that will help in improving the accuracy of the output?

    Reply
    1. ron Post author

      Regardless of operating system, there are a few things which can degrade accuracy.

      First of all, you need at least one high-quality sample of the font you want to recognize. This will be your training image. The more of these you have (of the same font), the more accurate it’s likely to be (and slower as well). In your training images, make sure the characters are separated by enough whitespace that the training image loader can easily find the whitespace between any two adjacent characters. In other words, don’t let any characters touch each other in the training image(s).

      Secondly, check your white threshold setting. I don’t recall exactly where it is — somewhere in the DocumentScanner class, if I recall correctly. The white threshold setting has an effect on the accuracy of character detection.

      Keep in mind, JavaOCR is an experimental library which achieves high levels of accuracy under controlled circumstances. However, it is not a general-purpose OCR engine.

      Reply
  5. Johan Quijano

    Greetings, Nice Work !! Thanks,

    I’m looking for something like your project but for Android :) If you know it I appreciate your recomendation.

    Bye
    J.Q.

    Reply
    1. ron Post author

      The JavaOCR project works on Android. If I’m not mistaken, there may even be some Android demos that the guys have written, right there in the source code. Be sure to get the latest from the git repository, rather than downloading a tarball. Enjoy!

      Reply
  6. Nas

    Sorry in advance for my question, but how can I get the result text using everything from Demo?
    It gives back chars, lines (so cool), but as images… not text

    Reply
    1. ron Post author

      The text is output to the console. When you run the demo from command line, you should see it outputting the text, I think. I did not write the latest demos though, so you’ll want to direct any further questions to the sourceforge project forum.

      Reply
  7. Craig

    Fantastic set of libraries :)

    I’m using them for my University Final Year Project where I do implement it onto an Android platform and it’s been a treat to work with :)

    I saw you mention that it is under MIT licence now? Will this mean I need to include the MIT Licence Terms spiel into my report or is it actually under the BSD Licence still?

    Also would you be against me adding you as a thanks into my acknowledgements? Just as a thankyou really :)

    Cheers!

    Reply
    1. ron Post author

      The new maintainers changed the license to MIT some years ago with my approval.

      No problem on the acknowledgement. Whatever you feel comfortable with.

      Glad you enjoyed the library!

      Reply
  8. Lukemtesta

    I’m only commenting to say fantastic work. I am also in the process of writing an open-source collision response system. After all the hair pulling and 10 hour coding sessions I’ve been through I’d just like to say thanks for releasing this code under the BSD license. It is very hard to get yourself to commit to this after the months of work which goes into this sort of project.

    Reply
  9. Nathan

    Hi, very interesting!
    I have one question, I’m working on an OCR for the Amharic language (my native language, I’m from Ethiopia), any ideas on how to do that? Thanks in advance. :)

    Reply
    1. ron Post author

      As long as your language can be separated into graphical glyphs representing characters, and those characters can be put together to form words, and the words are separated by spaces, it should be able to work for you. JavaOCR does a left-to-right, top-to-bottom scanning of the document, so it would be a problem for Chinese text, since Chinese text reads bottom-to-top, right-to-left if I remember correctly. If your language does not read left-to-right, top-to-bottom, then you may have to modify the DocumentScanner by creating a special subclass of DocumentScanner to scan your documents in the correct direction. Other than that, you should be fine.

      Reply
    1. ron Post author

      Did you mean to say that you cannot find the code?

      Have a look for OCRScannerDemo.java. It should be in the source code distribution. It provides an example of how to train the OCR engine and scan an image to extract the text, all in a single, simple command-line application.

      Reply
  10. Ashish

    How can i use this library in android application..
    as i m developing an android app and i want to scan a visiting card and fetch details on the card like phone no, address, email id, etc..
    reply soooooooon..

    Reply
    1. ron Post author

      Check out the “OCR Caller” and “OCR Fill-Up” apps by developr Konstantin Pribluda on Google Play Store. Konstantin is one of the contributors and maintainers of JavaOCR. I am told that both of these apps use JavaOCR to do their text recognition and extraction. If you send him a message on SourceForge (user ko5tik), he may offer you some pointers as to where to start writing an Android app using JavaOCR.

      Reply
  11. Sanjay

    scanner.clearTrainingImages(); I am getting error with this function
    Exception in thread “main” java.lang.NullPointerException

    I disabled above statement then in
    scanner.addTrainingImages(trainingImageMap);

    I am getting below error.

    Exception in thread “main” java.lang.NullPointerException
    at cardscan.loadTrainingImages(cardscan.java:92)

    I am using the default code at

    http://code.google.com/r/oscarklee-javaocr/source/browse/plugins/awt/src/main/java/net/sourceforge/javaocr/ocrPlugins/OCRDemo/OCRScannerDemo.java?r=ae4c2b7589b3d75d9b5cc6d58452d57723fea932

    I am unable to get images scanned and getting java.lang.NullPointerException upon using scanner.scan() function.

    Do I need to teach/ Train it all the fonts and sizes?

    Say I train it a font with font-size 10 will it automatically learn font-size 14 and higher?

    Bye
    Sanjay

    Reply
  12. Will

    Hi, thanks for this great library, but I’m unable to get the JavaDoc documentation, should I get it using maven or what?

    Thanks again, and sorry for my silly question :P

    Reply
    1. ron Post author

      I believe that you can build the JavaDoc documentation with Maven. Maven support was added after I released the library as open source. If it’s not obvious how to build the JavaDoc documentation, I would recommend posting a question on the SourceForge project page, which is located here: http://sourceforge.net/projects/javaocr/

      Reply
  13. Gorjan

    Hi, I am a student, and I want to use JavaOCR in a faculty related project… Because my project involves making an android application that uses this library, I was wondering if you could please answer me, where can I find a forum, or a discussion group or somewhere to ask a few questions about the current version of the library, because when I download a snapshot from the git page hosting the project, I get a tone of errors, specially with the maven build of the project…

    Thanks in advance, and keep up the good work :)

    Reply
  14. Mosty

    Hi Ron,

    I’ve been using your tool yesterday. It does a pretty good job. I’d like to make some comments as a way of providing constructive feedback from a user perspective that you might find useful.

    1. The documentation is very poor. As a software maintainer I know it is hard and time consuming to keep it updated and complete but it is a critical step
    2. I know there is an OCRScannerDemo.java absolutely hidden deep in many folders in the source code I downloaded. It did help to decrease the impact of the previous item. However, it is unnecessarily hard to read and it even uses deprecated classes such as the “old” PixelImage (I mean, there is a “new” PixelImage class in a different folder). Updating that file and moving it to a decent location seems to be critical too
    3. The flags you can control in the DocumentScanner should be more documented. They are just several of them but as they control the output the user should know every detail about what they do.
    4. Although the CharacterRange is pretty useful when you have a complete set of characters, whenever you don’t have all the characters from ‘!’ to ‘~’ you have to do a huge work splitting images into consecutive characters and then load each of those subsets. I think some kind of wrapper of that class that would allow the user to load just a String of characters from a file would be pretty useful. That would save a lot of editing time.
    5. Think a bit better if there should or should not be a grayscale and filter method call in the OCRScanner.scan() class. I noticed it is being called twice in the demo file as it is explicitly called in that file and in the scan() method. So I guess it should be moved out of one of those classes

    Having said that, I insist that the results I got were good.

    Now, I do have a question, probably related to item 3. I’ve some GIF images that contain text directly exported from a computer (I mean, nothing has been scanned in the real world). The files have contain extremely clear black text in a white background (see the files here). The font used was monospaced (EG: Consolas) so I thought that it would be an easy task for any OCR. I found out, however, that this was not the case for this library.

    The first issue I stumbled with was the fact that I couldn’t load the font in the TrainerImageLoader. After a lot of research (I ended up outputting “1″ and “0″ to the console to ASCII draw the image that JavaOCR was generating after the grayscale and filter phase performed during the loading) I found out that the text smaller than the library was expecting and hence it mixed letters (eg: rn could have been considered as an m). I fixed this by increasing the size of the images to load by 4 times (originally, they were 15 pixels height).

    After fixing that I thought that it was going to be enough to also increase the size of the images to compare by 4 times and that would be it. However, it was not the case. The library was able to translate every single character but the period. It is just being ignored in the results as it wasn’t there. Not even a space is being returned. The period is big enough now, so I guess the library is somehow comparing the size of the period with the size of the other characters and discarding it (remember the font is monospaced, though).

    I also tried modifying the code of the OCRScanner.scan() method so that it doesn’t perform the grayscale and filtering processes but that didn’t do the trick. I was actually expecting that to work as I have the 100% exact same period loaded in the trainer so if I don’t modify the input image it should 100% match the one in the trainer.

    I bet there must be some kind of value to set in the DocumentScanner so that it doesn’t interpret it as if it was garbage in the image. I played with some pseudo-random-and-guessed values to the different variables but that didn’t do the trick. Can you tell me how could I configure that object to improve the results or if you can think of a different workaround?

    Thanks in advance.

    PS: Sorry for the long and boring post.

    Reply
    1. ron Post author

      Thanks for your feedback!

      I’d like to refer you to the JavaOCR project page here: http://sourceforge.net/projects/javaocr/

      The reason is, I haven’t been actively involved in the project for a few years now. I know the volunteers who took it over have done some really nice things with it. Please make sure you’re evaluating the latest version. And if any of these issues still exist, please be sure to file bug reports for anything you see that’s still a problem.

      I developed this library many years ago to scan document identifiers for a document imaging system. The task was really simple, because the font was known (hence the font training). But the people who are working on it now are much more knowledgeable in OCR, so they’ve taken it much further than I could have envisioned.

      Thanks again for playing around with JavaOCR, and for giving your feedback!

      Reply
  15. Van

    Hi, Ron

    Thanks for your great project.
    I’m developing an OCR application on Android.
    I want use a least-square-error matching algorithm but I don’t understand this algorithm clearly.
    So, would you send me some documents about this algorithm.

    Thanks very much,
    Van

    Reply
    1. ron Post author

      The algorithm is very simple. As a result, there’s no need to document it extensively. If you read the code, it’s pretty straightforward.

      But I’ll describe it in general here.

      The first step is loading and pre-processing the training images. The training image loader chops up a series of characters in the image into sub-images, based on how much whitespace there is between subsequent images. You tell it the range of characters in the image, make sure there’s enough whitespace between the characters in the training image(s), and it loads them up, chops them into individual character sub-images, calculates the aspect ratio of each character sub-image, and stores the character sub-images and their aspect ratios away under their respective character codes.

      The second and final step is the actual scanning of the document and converting it to text. The document scanner chops the document into rows of text (lines) and characters within those lines, based on a whitespace detection algorithm. It’s VERY important that the document be properly aligned. Any tilt left or right, and scanning will fail miserably. When processing the document, each character’s aspect ratio is calculated. Then the training images are qualified by aspect ratio, so that training images which are way off from the aspect ratio of the candidate are ignored. Candidate image refers to the character subimage extracted from the document being scanned, and corresponds to one character of final text output. After the aspect ratio qualification, each qualified training image (which passed the aspect ratio test) is then scaled to the exact same size (and aspect ratio) as the candidate image and compared, pixel-by-pixel, to the candidate image. The differences in pixel values between the training image and the candidate image are squared and summed. The training image which has the smallest sum of the squared pixel difference is the winner. We then output the corresponding character. Once all of the character cells in all of the lines of text are processed, the document is done.

      There can be multiple training images, each containing different (or the same) ranges of characters. However, if they are of widely varying fonts, accuracy may suffer. Also, scanning speed decreases as the number of training images increases.

      The algorithm is called a Least-Mean-Squared-Error algorithm because it skips the square root calculations (as required by Pythagorean Theorem). But in every case, it selects the same training image that a Least-RMS-Error algorithm would select. The candidate and training images are basically treated like N-dimensional vectors, where N is width times height. That’s why Pythagorean Theorem works, because it’s a vector distance calculation formula. We’re looking for the training image with the minimum RMS error when compared to the candidate image. However, we don’t need to do the square root portion of the RMS calculation (which is simply Pythagorean Theorem repurposed) because the sums of the squared differences are sufficient when compared to each other. Skipping the square root calculation results in a much faster algorithm.

      Reply
  16. sree

    My requirement is need to convert a scanned document which contain text into a word document.
    is this ocr application to do this or not if so what are the changes i need to change.
    plz help me… its very argent

    Reply
    1. ron Post author

      JavaOCR is an API library which was designed to enable Java developers to write Java applications with OCR functionality. Unless you are a Java developer with interest in learning how OCR works, and helping to improve the OCR accuracy of JavaOCR, this project probably won’t be of much interest to you.

      There is a command-line OCR application, OCRScannerDemo, which, if trained with samples of your fonts, can deliver a decent conversion accuracy. If you understand Java development, I recommend reading the JavaDocs as a starting point, and then looking at OCRScannerDemo.java.

      Reply
  17. Jean-Pascal Laux

    Hi Ron,

    I have just downloaded your distribution from sourceforge. The zip file contains several files with no documentation, so I don’t know how to start.
    Could explain the role of each files and give me a sample example to use your software ?
    Thanks in advance.

    JP

    Reply
    1. ron Post author

      It should all be in the JavaDoc documentation when you build the JavaOCR library. Check on the SourceForge discussion page for this project. If there’s no quick start, please ask the maintainers to write it. You may have to file a bug report. They’re pretty good about quickly following up on issues. There should be at least build instructions, along with instructions on how to run the OCRScannerDemo command-line application.

      Keep in mind, this is targeted toward developers rather than end users. In other words, it’s an API library rather than an application.

      If you’re interested in contributing some time to help write a README or a quickstart guide, I can guarantee your help would be greatly appreciated.

      Thanks for your interest!

      Reply
  18. Mahmoud

    Hello Mr. Ron I want to start an android project that makes use of optical character recognition (OCR) I found your library upon searching but I wanted to know from you where could I learn optical character recognition from the basics up to building algorithms, and how could I understand all the classes in your library you have build for this purpose and would it be able to get integrated with android ? I would really appreciate your help.

    Reply
  19. Harmeet Singh

    Hello Ron, your Java OCR libraries are really good, but i have some doubt, i downloaded the file from http://sourceforge.net/projects/javaocr. But these are package of jar files. how i import these jar files in maven and create JavaDocs. i want to use OCR in my web application ad recognize handwriting scanned document. this library will support handwriting recoganization or not ?

    Reply
    1. ron Post author

      I think you’ll probably want to start with the full sources. That way, you can build it with full JavaDocs. You can get the sources using git via the git URL provided on the SourceForge.net project page.

      Reply
        1. ron Post author

          I’ve never done any work on handwriting recognition, but some of the other maintainers have. I recommend reading the comments in the source code. It really is a small project, so looking over the source code is a very trivial task. I recommend doing that first.

          Reply
  20. ayush

    hi ron,

    your project which I have downloaded is working fine. just for the documentation part do you have any documents related to software development (SE) cycle related to this project. And any base paper related to the project will be really helpful.

    Reply
    1. ron Post author

      Hi Ayush,

      The software development cycle is: develop, compile, test/debug, release. Not sure what you’re asking for there. We don’t have (or tolerate) much bureaucracy or red tape in the open source world.

      As far as a base paper goes, the only thing we have is the comments in this thread, and the discussion board on the sourceforge project. It’s a very open development process. If you look through the comments, I’ve described the algorithm in detail.

      As far as papers go, several have used this project as an information source and testbed for their degree theses. You’re welcome to do the same. Just don’t claim that you developed the software or came up with the ideas that make it work. Give credit where credit is due, and all of that.

      Reply
    1. ron Post author

      It’s all in the demo code. I recommend reading the source code, since it is very small. This is really a very simple project. Also look for main() functions inside the source files. Each of those are runnable. There should be an OCRScannerDemo.java (or OcrScannerDemo.java) file somewhere in there which does everything you want to do. Check the discussion board on the sourceforge project page. The maintainers have dealt with this question there, I believe.

      Reply
  21. Chizheng Wang

    Hi Ron, I am trying to use your OCR in on of my projects. However after I download the released version from SourceForge I can’t find the OCRScannerDemo.java file. Could you give me a pointer to that? Thanks.

    Reply
    1. ron Post author

      Check the message board on the sourceforge project page. I believe the maintainers have dealt with this question there.

      Reply
  22. Ballu

    Hello Ron
    I must say you have done great job by making JavaOCR and doimng great job by answering almost all post

    Hats off to you !!!!!

    I have oen question , I want to develop one android app , which can start mobile camera and from that user can take picture of either laptop screen or paper and later I have to traverse through image to do some sort of code validation

    What potion of my project can be handled by your Java OCR and any other guidelines for me

    Thanks in advance

    Reply
    1. ron Post author

      In its current state, I’d think JavaOCR might be difficult to use for that type of task, as it doesn’t have what is called “document registration” functionality. That is, it has nothing to tilt or shear the document to make it perfectly square and horizontally aligned before beginning to scan the document for lines of text and character cells within those lines of text. So you’d most likely need to provide that kind of functionality yourself, or get a straight-on, perfectly level, high-resolution camera shot.

      Reply
  23. Peter Murray-Rust

    Dear Ron Cemer,
    We are keen to re-use JavaOCR and have downloaded the 2012 version. There doesn’t seem to have been any activity for two years (http://sourceforge.net/p/javaocr/mailman/message/29898556/ ). We’ve got it working (though we’ve had to strip out the Android stuff and de-modularise the Maven as it no longer builds in some JavaVMs).

    It doesn’t seem that the later developers are active (that’s not a moral judgment! – I have left projects in limbo myself). If you have their emails I would be happy to contact them and get the latest position.

    If we don’t hear positively that they are working on it we’d like to fork parts of the project – obviously with positive attribution. We’re particularly keen on the Mahalonobis and Hu Moments. We’d like to add some of our own features (the topology of character skeletons) to help resolve difficult characters (e.g. “c” and “o” or “8″ and “B”) We’d probably use BoofCV for the filtering as it is active and documented. and modularise JavaOCR to the actual character recognition and not preprocessing – assuming that is reasonable.

    Please communicate with the others if you have their addresses.

    You should now have my email (see also http://en.wikipedia.org/wiki/Peter_Murray-Rust) and would love to hear from you

    All my code is FLOSS – most is Apache2 and I am particularly keen in liberating data both from technological constraints (e.g. pixels) and legal (publishers and corporations)

    P.

    Reply
    1. ron Post author

      Thanks for your interest in JavaOCR. You are probably correct about it being unmaintained at this point. I certainly haven’t done much work on it in the past several years. I will contact you separately by email, but I would actually like to add you and your team as maintainers/admins to the JavaOCR project, if you’re interested. That way, you can do all of the improvements right there in the JavaOCR project. I’m not a big fan of forking when it comes to adding features and functionality. I’d love to see JavaOCR become something really useful, and the way I see that happening is through teamwork and iterative improvements. Someone does a bit here, someone else does a bit there, and so on.

      Reply
  24. Don

    Hi Ron,

    First, thanks for making this component! Seems many people have benefited from what you have done. Now, I haven’t used this myself but I would like to know if I could use this to read Seven Segment Led displays. I came across this software (http://www.unix-ag.uni-kl.de/~auerswal/ssocr/) and I was wondering if your software can accomplish the same thing? I needed a java ocr so I prefer to use yours.

    Thanks a lot!

    Don

    Reply
    1. ron Post author

      If you train it with that font, it should be able to recognize it. The only thing you’d need to do is ensure that the training image and the image to be scanned are both black characters on a white background. So the LED segments need to be black when on, white when off, on a white background. Create at least one sample image of every character you want to recognize, and use those for your training images.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


× seven = 21

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>