0

I have this image:

image

And I try to read all of these numbers.

I was trying with

<dependency>
    <groupId>com.asprise.ocr</groupId>
    <artifactId>java-ocr-api</artifactId>
    <version>15.3.0.3</version>
</dependency>

Ocr.setUp();
Ocr ocr = new Ocr();
ocr.startEngine("eng", Ocr.SPEED_SLOW);
String s = ocr.recognize(new File[]{new File("img.png")}, Ocr.RECOGNIZE_TYPE_TEXT, Ocr.OUTPUT_FORMAT_PLAINTEXT);
System.out.println("Result: " + s);
ocr.stopEngine();

And

<dependency>
    <groupId>net.sourceforge.tess4j</groupId>
    <artifactId>tess4j</artifactId>
    <version>5.7.0</version>
</dependency>

//+ installed tesseract-ocr - 5.3.1.20230401

Tesseract tesseract = new Tesseract();
tesseract.setDatapath("D:\\programming\\tessaract-ocr\\tessdata");
String text = tesseract.doOCR(new File("img.png"));
System.out.print(text);

But in both cases the output is just some random chars.

There is a way that I can read the numbers from image?

Edit1: I tried with bigger numbers, and still the same problem:

bigger numbers

KunLun
  • 3,109
  • 3
  • 18
  • 65

0 Answers0