I want to use tess4j in an Androïd app.
I test a simple snippet, works fine in Linux env, but fails in Androïd env.
File imageFile = new File("...");
ITesseract instance = new Tesseract();
instance.setDatapath("...");
...
try {
String result = instance.doOCR(imageFile);
System.out.println(result);
}
catch (TesseractException e) {
System.err.println(e.getMessage());
}
Androïd needs to target JDK 1.8 and then there's a compile error: error: cannot access BufferedImage
class file for java.awt.image.BufferedImage not found
In the ITesseract there are methods doOCR() with input java.awt.image.BufferedImage parameter. Tess4j would be very usefull for an Androïd use of tesseract, but "linking" with awt prevents that.
Is there a workaround to avoid such an issue ?
Is there a way to use doOCR() with stream, such as FileInputStream or InputStream ?
Help appriciate.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I want to use tess4j in an Androïd app.
I test a simple snippet, works fine in Linux env, but fails in Androïd env.
File imageFile = new File("...");
ITesseract instance = new Tesseract();
instance.setDatapath("...");
...
try {
String result = instance.doOCR(imageFile);
System.out.println(result);
}
catch (TesseractException e) {
System.err.println(e.getMessage());
}
Androïd needs to target JDK 1.8 and then there's a compile error:
error: cannot access BufferedImage
class file for java.awt.image.BufferedImage not found
In the ITesseract there are methods doOCR() with input java.awt.image.BufferedImage parameter.
Tess4j would be very usefull for an Androïd use of tesseract, but "linking" with awt prevents that.
Is there a workaround to avoid such an issue ?
Is there a way to use doOCR() with stream, such as FileInputStream or InputStream ?
Help appriciate.
BufferedImage
class is not supported on Android platform.Android API
does not include thejava.awt.image
package.Try tess-two for OCR development on Android.