Tesseract OCR not working in Web Project

时间:2016-04-25 09:28:43

标签: java eclipse tesseract web-project

I'm trying to use Tesseract OCR in a web application. The code runs fine when I run it as a JAVA application. But as soon as I put the same code in my web application, it doesn't work anymore. If put the function in the servlet, tomcat doesnt start at all. If I call it from a separate class by creating an object, On debugging I find that the object does not get created at all. I have included all the jars necessary.

Code in servlet

OCRFullTrial ot = new OCRFullTrial();
ot.imgOCR();

Inside other class

public void imgOCR(){
    File imageFile = new File("D:\\OCRTesting\\0.jpg");

try {
     ITesseract instance = new Tesseract();  //            
    System.out.println("1");

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

1 个答案:

答案 0 :(得分:0)

我认为您应该检查一些指示,以防您在基于Web的项目中使用Tess4j:

var data = {action: getPayments(what's this?)};
var req = {
         method: 'POST',
         url: 'process.php',
         data: data
        }

        $http(req).then(function(req){
            console.log(req.data);
            $scope.bidslist = req.data;
        }, function(){

        });

交叉检查上述步骤并尝试再次运行。希望它有效