4

I would like to do OCR with java and I use IntelliJ. But I don't know what are the files I need for my project.

My code is just a simple OCR:

import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;

import java.io.File;

public class Main {

    public static void main(String[] args) {
        System.out.println("Hello World!");
        Tesseract instance = new Tesseract();
        File f = new File("asd.jpg");

        try {
            String result = instance.doOCR(f);
            System.out.println(result);
        } catch (TesseractException e) {
            System.err.println(e.getMessage());
        }
    }
}
Gabe
  • 624
  • 8
  • 19
  • Coming from Visual Studio / F#, now using IntelliJ / SBT / Scala, I am trying to wrap my head around how to add tess4j... Just here to give mental support: you are not alone. I will write an answer if I can. – bugfoot Feb 27 '17 at 20:10

1 Answers1

0

Add this dependency on pom.xml

<dependency>
    <groupId>net.sourceforge.tess4j</groupId>
    <artifactId>tess4j</artifactId>
    <version>4.3.0</version>
</dependency>
Obsidian
  • 3,719
  • 8
  • 17
  • 30