I succed to extract text from an image with Tesseract library. Now I want to achieve is the segmentation of each character from picture with the bounding box of each character. I've write my code just like some tutorial, here's my source code :
String SourceImage = cursor.getString(URIImage);
Bitmap OutputImagePicker = BitmapFactory.decodeFile(SourceImage); 
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.setDebug(true);
baseApi.init(Path, Language);
baseApi.setImage(OutputImagePicker);
String Text = baseApi.getUTF8Text();
final ResultIterator iterator = baseApi.getResultIterator();
String lastUTF8Text;
     float lastConfidence;
     int[] lastBoundingBox;
     int count = 0;
     iterator.begin();
     do {
         lastUTF8Text = iterator.getUTF8Text(PageIteratorLevel.RIL_WORD);
         lastConfidence = iterator.confidence(PageIteratorLevel.RIL_WORD);
         lastBoundingBox = iterator.getBoundingBox(PageIteratorLevel.RIL_WORD);
         count++;
         } 
     while (iterator.next(PageIteratorLevel.RIL_WORD));
 baseApi.end(); 
 RecognizedText.setText(Text);
 ImageOutput.setImageBitmap(OutputImagePicker);
But, the result is picture bitmap no line bounding box ??? What's wrong with my source ??? i confuse, i've search some tutorials about this, but there's no one explain about it. Is anyone know how to achieve it ??? Please ???
EDITED
I got advice from Nguyenq that i need to draw rect using coordinat in lastBoundingBox, here's my code to draw it :
      Canvas canvas = new Canvas(OutputImagePicker);
      // Draw bounding boxes around each word         
      for (int i = 0; i < lastBoundingBox.length; i++) {
        paint.setAlpha(0xFF);
        paint.setColor(Color.RED);
        paint.setStyle(Style.STROKE);
        paint.setStrokeWidth(2);
        int Rect = lastBoundingBox.length;
        canvas.drawRect(Rect, paint);
      } 
But, it still give an error, it said "The method drawRect(Rect Paint) in the type Canvas is not applicable for arguments int paint", as shown below ,.... what should i do ???
 
    