1
import java.awt.image.RenderedImage;
import java.io.File;
import java.net.URL;

import javax.imageio.ImageIO;
import net.sourceforge.tess4j.Tesseract;

public class Tess4JSample {

public static void main(String[] args) throws Exception{

    URL imageURL = new URL("http://s4.postimg.org/e75hcme9p/IMG_20130507_190237.jpg");    
    RenderedImage img = ImageIO.read(imageURL);
    File outputfile = new File("saved.png");
    ImageIO.write(img, "png", outputfile);

    try {
    Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping

    //   Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping

        String result = instance.doOCR(outputfile);
        System.out.println(result);

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }

}
}

对于这个程序,我已经把 jar 文件tess4j-1.5.0jai_imageio-1.1. 但它仍然显示error

The import net.sourceforge cannot be resolved

谁能告诉我为解决错误需要采取哪些必要措施?我从堆栈溢出本身中获取了这个程序。谢谢!提前。

4

0 回答 0