Tesseract 3.0 with Tess4j crashing the Application on linux server

元气小坏坏 提交于 2019-12-06 22:47:27

create bean for Tesseract1

@Bean
public Tesseract1 tesseract() {
    return new Tesseract1();
}

in Service : autowire Tesseract

@Autowire
private Tesseract1 instance;

put doOcr method inside synchronized block

syncrhonized(instance){
   String result = instance.doOCR(imageFile);
   //other stuff
}

Now Service Thread will run without crashing the application.

Note: we are loosing the concurrent OCR for simultaneous document request.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!