Same screenshot obtained with different capture methods giving different OCR results

60 Views Asked by At

I am taking screenshots on Android with two different methods:

  1. By running /system/bin/screencap -p $path.
  2. With the MediaProjection API.

Even though it's the exact same screen, when performing OCR (with the use of Tesseract) I get different results.

With /system/bin/screencap I get the expected results. With the MediaProjection API is unable to recognise all text correctly, hence I need to preprocess the image.

Why is that? Maybe it depends on different configurations of the Bitmap file I pass as argument to Tesseract? Meaning the bitmap decoded from the system command has a different configuration than the bitmap created from the mediaprojection API?

This is how I am creating the bitmap from the MediaProjection API:

https://github.com/commonsguy/cw-omnibus/blob/master/MediaProjection/andshooter/app/src/main/java/com/commonsware/android/andshooter/ImageTransmogrifier.java

0

There are 0 best solutions below