Open alexprest opened 13 years ago
Here is how it worked for me: http://stackoverflow.com/questions/4560587/business-card-reader-or-ocr-library-for-iphone-sdk/5443102#5443102
I did follow your comment at stackoverflow and added [self startTesseract]; to the viewDidLoad() method in OCRDemoViewController but still i am having problem as below.
Nolan has already applied the fix I proposed, so it should work if you just take the code from here: https://github.com/nolanbrown/Tesseract-iPhone-Demo
If you still have problems, try to paste some of your code as a gist, so that we can see concretely how you're doing things.
Cheers, Leonardo.
Thanks leogomes for your reply.
Yes i have already downloaded code from link which you provided and also i seen that the fix is there. However when i cross check point of crash into app , below is what i find.
My app opens and the moment i select image from camera or from image picker then it goes to resize it and there it is problem inside resizeimage function i am getting width and height as Zero. I think it should give us the height and width of actual image ..correct ?
I also checked that object coming into resizeimage is not Null.
Waiting for your reply on this.
Thks Nekin
I remember there was a problem with the height and width but I can't actually tell what and I don't have my mac here right now.
You could give a try to this: http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/
It's more up-to-date and seems to work quite fine from what I've read in the tesseract mailing list.
Cheers, Leo.
Guys, in the very first comment of this discussion the code snippet says: char* text = tess->TesseractRect(imageData,(int)bytes_per_pixel,(int)bytes_per_line, 0, 0,(int) imageSize.height,(int) imageSize.width);
But looking at the official documentation at http://tesseract-ocr.repairfaq.org/classTessBaseAPI.html the TesseractRect method is defined as follows:
static char * TesseractRect (const UINT8 *imagedata, int bytes_per_pixel, int bytes_per_line, int left, int top, int width, int height)
...the width and height parameters are swapped.
As for me, it solved my problem.
I'm trying to compile your demo using the oldest iOS sdk available nowadays which is 3.2 At runtime, after taking the photograph the program crashes with EXC_BAD_ACCESS during the following call:
char* text = tess->TesseractRect(imageData,(int)bytes_per_pixel,(int)bytes_per_line, 0, 0,(int) imageSize.height,(int) imageSize.width);
Other users are experiencing the same problem, there's a stackoverflow thread about it: http://stackoverflow.com/questions/4560587/business-card-reader-or-ocr-library-for-iphone-sdk
Have you tried running your code with SDK 3.0 or greater? Thanks for your precious work!