androidtesseractandroid-bitmapleptonicatess-two

How to convert Leptonica Pix Object to Android's Bitmap


I have a Leptonica Pix object returned by

TessBaseApi.getThresholdedImage();

now, how can I convert it to bitmap so that I can show it through the ImageView.

leptonica.android.Pix to android.graphics.Bitmap;

I didn't find conversion methods looking at the API files.


Solution

  • For someone with the problem I found the way after lot of searching in the source .java files:

    import com.googlecode.leptonica.android.WriteFile;
    

    and then pass the pix object to writeBitmap.

    Bitmap bitmap = WriteFile.writeBitmap(pixObject);