我该如何在IntelliJ中使用Tess4j?

4

我想使用Java进行OCR,并且我使用IntelliJ。但是我不知道我需要哪些文件来完成我的项目。

我的代码只是一个简单的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());
        }
    }
}

从使用Visual Studio / F#转向使用IntelliJ / SBT / Scala,我正在努力理解如何添加tess4j...只是在这里给予精神支持:你并不孤单。如果我能的话,我会写一个答案。 - bugfoot
1个回答

0

pom.xml中添加此依赖项

<dependency>
    <groupId>net.sourceforge.tess4j</groupId>
    <artifactId>tess4j</artifactId>
    <version>4.3.0</version>
</dependency>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接