Tesseract - OCR recognition, invalid memory access

Asked

Viewed 146 times

0

I am trying to read a license plate of a car/truck using the java Tesseract. However, I am experiencing error. I still can’t understand why.

Follows:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         

    File imageFile = new File("C:/teste/placa_caminhao.jpg");
    Tesseract tesseract = new Tesseract();
    tesseract.setDatapath("C:/teste/tesseract");
    tesseract.setLanguage("eng");


    try {
        String result = tesseract.doOCR(imageFile);
        System.out.println(result);
    } catch (TesseractException e) {
        System.err.println(e.getMessage());
    }
}     

Error:

Exception in thread "AWT-Eventqueue-0" java.lang.Error: Invalid memory access at com.sun.jna.Native.invokePointer(Native Method) at com.sun.jna.Function.invokePointer(Function.java:470) at com.sun.jna.Function.invoke(Function.java:404) at com.sun.jna.Function.invoke(Function.java:315) at com.sun.jna.Library$Handler.invoke(Library.java:212) at com.sun.proxy. $Proxy0.Tessbaseapigetutf8text(Unknown Source) at net.sourceforge.tess4j.Tesseract.getOCRText(Tesseract.java:437) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:292) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:213) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:197) at com.nexello.testesnexello.Main.jButton1ActionPerformed(Main.java:72) at com.nexello.testesnexello.Main.access$000(Main.java:14) at com.nexello.testesnexello.Main$1.actionPerformed(Main.java:39) at javax.swing.Abstractbutton.fireActionPerformed(Abstractbutton.java:2022) at javax.swing.Abstractbutton$Handler.actionPerformed(Abstractbutton.java:2348) at javax.swing.Defaultbuttonmodel.fireActionPerformed(Defaultbuttonmodel.java:402) at javax.swing.Defaultbuttonmodel.setPressed(Defaultbuttonmodel.java:259) at javax.swing.plaf.basic.Basicbuttonlistener.mouseReleased(Basicbuttonlistener.java:252) at java.awt.Component.processMouseEvent(Component.java:6539) at javax.swing.jcomponent.processMouseEvent(Jcomponent.java:3324) at java.awt.Component.processEvent(Component.java:6304) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.Lightweightdispatcher.retargetMouseEvent(Container.java:4904) at java.awt.Lightweightdispatcher.processMouseEvent(Container.java:4535) at java.awt.Lightweightdispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.Eventqueue.dispatchEventImpl(Eventqueue.java:760) at java.awt.Eventqueue.access$500(Eventqueue.java:97) at java.awt.Eventqueue$3.run(Eventqueue.java:709) at java.awt.Eventqueue$3.run(Eventqueue.java:703) at java.security.Accesscontroller.doPrivileged(Native Method) at java.security.Protectiondomain$Javasecurityaccessimpl.doIntersectionPrivilege(Protectiondomain.java:74) at java.security.Protectiondomain$Javasecurityaccessimpl.doIntersectionPrivilege(Protectiondomain.java:84) at java.awt.Eventqueue$4.run(Eventqueue.java:733) at java.awt.Eventqueue$4.run(Eventqueue.java:731) at java.security.Accesscontroller.doPrivileged(Native Method) at java.security.Protectiondomain$Javasecurityaccessimpl.doIntersectionPrivilege(Protectiondomain.java:74) at java.awt.Eventqueue.dispatchEvent(Eventqueue.java:730) at java.awt.Eventdispatchthread.pumpOneEventForFilters(Eventdispatchthread.java:205) at java.awt.Eventdispatchthread.pumpEventsForFilter(Eventdispatchthread.java:116) at java.awt.Eventdispatchthread.pumpEventsForHierarchy(Eventdispatchthread.java:105) at java.awt.Eventdispatchthread.pumpEvents(Eventdispatchthread.java:101) at java.awt.Eventdispatchthread.pumpEvents(Eventdispatchthread.java:93) at java.awt.Eventdispatchthread.run(Eventdispatchthread.java:82)

1 answer

0


  • 2

    While this link may answer the question, it is best to include the essential parts of the answer here and provide the link for reference. Replies per link only can be invalidated if the page with the link is changed. - Of Revision

  • Thanks for the tip.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.