OpenCV から取得した画像を処理する必要があります。
私はこれまでに書いた:
IplImage* img=0;
img=cvLoadImage("paket2.tif");
api.SetRectangle(0,0,img->width, img->height);
api.SetImage((uchar*)img->imageData,img->width,img->height,img->depth/8,img->width*(img->depth/8));
//i tried also below line
//api.SetImage((uchar*)img->imageData,img->width,img->height,img->depth/8,img->widthStep);
int left,top,right,bottom;
left=0;top=0;right=0;bottom=0;
api.Recognize(NULL);
tesseract::ResultIterator *ri=api.GetIterator();
char * sonuc=(*ri).GetUTF8Text(tesseract::RIL_SYMBOL);
if((*ri).BoundingBox(tesseract::RIL_SYMBOL,&left,&top,&right,&bottom))
{printf("bb dogru\n");printf("%d,%d,%d,%d",left,top,right,bottom);}
printf("sonuc:%s",sonuc);
IplImage->widthStep をバイトごとに渡すと、左右の値に「間違った」境界ボックスがあり、画像内のすべてのテキストを読み取ることができません。
IplImage->width*(IplImage->depth/8) を渡すと、boundingBox 関数は false を返します。
アイデアをいただければ幸いです。前もって感謝します。