Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

EXC_BAD_ACCESS #2

Open
alexprest opened this issue Feb 5, 2011 · 6 comments
Open

EXC_BAD_ACCESS #2

alexprest opened this issue Feb 5, 2011 · 6 comments

Comments

@alexprest
Copy link

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!

@leogomes
Copy link
Contributor

@nekin
Copy link

nekin commented Nov 11, 2011

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.

  1. when i take image from camera and click on USE it crashes and shows EXC_BAD_ACCESS
  2. if i select picture from gallery then it takes picture and then after coming back to screen of app it just shows picture there as it is. i do not have any idea on how to proceed further from there. OR how can i get data extracted from that image ?

@leogomes
Copy link
Contributor

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.

@nekin
Copy link

nekin commented Nov 14, 2011

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

@leogomes
Copy link
Contributor

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.

@primsky83
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants