I'm currently writing an Android application which needs to use OCR within it.
To achieve this I am using Tesseract in conjunction with the tesseract-android-tools project.
I have managed to get the Tesseract API to initialize and need to use the following setImage function:
void com.googlecode.tesseract.android.TessBaseAPI.setImage(byte[] imagedata, int width, int height, int bpp, int bpl)
What I am struggling with is how to get the correct values for bpp (bytes per pixel) and bpl (bytes per line). Does anyone know how I can get these values? I have put fairly random values in there at the moment and believe it is causing errors later on.
I should note that the application is also using JavaCV for image recognition which is recognising images fine and I'm using the same source of image data for this tesseract call.
Thanks.
I actually did the same and got it working. I guess you'll use somehow the camera and the camera preview to capture the screen for the OCR recognition. Therefore you can get the camera preview format, which allows you through the PixelFormat to retrieve the BytesPerPixel.
I'll give you a short example:
I hope it helps. If you'll have further questions let me now.
Best wishes and good luck, Volker