How to work without Java.awt.image?

Asked

Viewed 59 times

1

I need a help on using OCR on Android, all libraries I’ve tried to use to convert image to Text needs either a Bufferedimage or a Renderedimage both of which are in the Java.awt.image library that is not present on Android. The code has no error in my Android Studio but when I compile the error:

Error:(111, 57) error: cannot access RenderedImage
class file for java.awt.image.RenderedImage not found

I am using Asprise’s OCR and have tested various libraries adapted from the Tesseract already compiled for Java but does not work.

Does anyone have an idea of how to get around this perhaps with Android Graphics or in any other way, some third party library.

String pictureFile = "MinhaFoto_" + date + ".jpg";
String filenameFull = pictureDir.getPath() + File.separator + pictureFile;
File pictureFileFull = new File(filenameFull);

try {
    FileOutputStream fos = new FileOutputStream(pictureFileFull);
    fos.write(data);
    fos.close();

    Ocr.setUp(); // one time setup
    ocr = new Ocr(); // create a new OCR engine
    ocr.startEngine("por", Ocr.SPEED_FASTEST); // Portugues
    String textoConvertido = ocr.recognize(new File[] {pictureFileFull},
            Ocr.RECOGNIZE_TYPE_ALL, Ocr.OUTPUT_FORMAT_PLAINTEXT); // PLAINTEXT | XML | PDF | RTF

    ocr.stopEngine();
No answers

Browser other questions tagged

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