Tag: tess4j

JAVA Tess4j doOCR()不工作,exception“内存访问无效”

我在eclipse中的动态Web项目中工作,我创建了一个包含以下内容的TesseractOCR类: public class TesseractOCR { public TesseractOCR() { } public String doOCR(String file) { System.setProperty(“jna.library.path”, “32”.equals(System.getProperty(“sun.arch.data.model”)) ? “lib/win32-x86” : “lib/win32-x86-64”); File imageFile = new File(“C:\\Users\\Sherein Dabbah\\Downloads\\ca096-d7a6d799d7a1d798d799d7a72.jpg”); Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping Tesseract1 instance1 = new Tesseract1(); instance.setLanguage(“heb+eng”); // Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping // File tessDataFolder = LoadLibs.extractTessResources(“tessdata”); […]

Windows 64位上的Tess4j:multithreading上的exception

我在Windows 64位上使用tesseract 3和Java 8到OCR扫描的PDF。 我已按照Tess4j页面上的说明操作并使用了所需DLL的64位版本,并安装了64位Ghostscript。 当我使用正常的@Test(无参数)运行我的unit testing时, 代码运行正常 ,所以我想我已经正确安装了所有内容。 当我用2个并行线程运行它时(见下文)我得到一个例外。 我已经在这里阅读了相关的主题,但是建议使用我正在使用的Tesseract1(我已经尝试过)。 有任何想法吗? 这是代码: // @Test // works @Test(invocationCount = 2, threadPoolSize = 2) public void testOcr() throws OcrException, TesseractException { File scannedPdf = new File(this.getClass().getClassLoader().getResource(“scanned.pdf”).getFile()); // Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping String str […]