You could use ImageMagick libraries to preprocess that image so it shows the text. It will not be simple, but some people on this forum have done that before (not me). --Sven
On Wed, Oct 9, 2013 at 3:53 PM, zdenko podobny <[email protected]> wrote: > In case you did not binarize input image and you got strange output: > ALLWAY check a thresholded image (GetThresholdedImage()) - see adapted you > code and thresholdedImage.png > > Zdenko > > > On Mon, Oct 7, 2013 at 2:06 PM, Veerendra Jonnalagadda < > [email protected]> wrote: > >> Hi >> I have written simple code in C to extract text from Image. >> But it is extracting only one line but I need all four lines to be >> extrated.... >> Please Help me.... >> Regards >> Veerendra >> >> #include<stdio.h> >> #include<tesseract/baseapi.h> >> #include<tesseract/strngs.h> >> #include<leptonica/allheaders.h> >> int main(int count, char** string) >> { >> int confidence; >> char* text; >> const char* lan="eng"; >> const char* img_path; >> if (count < 2) >> { >> printf("Empty path"); >> return -1; >> } >> img_path=string[1]; >> tesseract::TessBaseAPI* ocr = new tesseract::TessBaseAPI(); >> printf("Tesseract-ocr version is %s\n", ocr->Version()); >> printf("Leptonica version is %s\n", getLeptonicaVersion()); >> if(ocr->Init(NULL, lan, tesseract::OEM_DEFAULT)) >> { >> printf("tesseract-ocr initialize error\n"); >> return -1; >> } >> FILE* in = fopen(img_path, "rb"); >> if (in == NULL) { >> printf("can not open path ...\n"); >> return -1; >> } >> fclose(in); >> system("convert Playing.bmp Playing.tiff"); >> Pix *img = pixRead("Playing.tiff"); >> ocr->SetImage(img); >> Boxa* box=ocr->GetComponentImages(tesseract::RIL_TEXTLINE,true,NULL,NULL); >> printf("Number of Text Line is %d\n",box->n); >> for (int z = 0; z < box->n; z++) >> { >> BOX* b = boxaGetBox(box, z, L_CLONE); >> ocr->SetRectangle(b->x, b->y, b->w, b->h); >> text = ocr->GetUTF8Text(); >> confidence = ocr->MeanTextConf(); >> printf("TEXT is %s\n",text); >> } >> pixDestroy(&img); >> ocr->End(); >> return 0; >> } >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "tesseract-ocr" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/tesseract-ocr?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "tesseract-ocr" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > -- > You received this message because you are subscribed to the Google > Groups "tesseract-ocr" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/tesseract-ocr?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "tesseract-ocr" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- ``All that is gold does not glitter, not all those who wander are lost; the old that is strong does not wither, deep roots are not reached by the frost. >From the ashes a fire shall be woken, a light from the shadows shall spring; renewed shall be blade that was broken, the crownless again shall be king.” -- -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tesseract-ocr?hl=en --- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

