Closed alimoeeny closed 9 years ago
Can you provide the code (or at least the tesseract-related parts) you're using that triggers this error? What image are you trying to recognize on?
Thanks @kevincon for your reply. I am running the provided example. I run it on iOS 8.1.2 using Xcode 6.2 .
I tap on the touch for camera
take a photo and see the error "most of the time" which leads to empty results or I see gibberish.
I'm running into the same issue on device, it's an iPhone 5 with iOS 8.1.3
Thanks for reporting this issue, guys. It is related to issue #147 and an in-progress pull request #131. Basically, our internal pixForImage
method is not taking into account image orientation, so it crashes unless the orientation is "up".
As a quick fix, you can replace the imagePickerController:picker didFinishPickingMediaWithInfo:info
method in the Template Framework Project with the code below. That got everything working for me.
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = info[UIImagePickerControllerOriginalImage];
[picker dismissViewControllerAnimated:YES completion:nil];
// Redraw the image (if necessary) so it has the corrent orientation:
if (image.imageOrientation != UIImageOrientationUp) {
UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
[image drawInRect:(CGRect){0, 0, image.size}];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
[self recognizeImageWithTesseract:image];
}
I know @ws233 and @BamX are still working on the pull request, but we'll make sure to have this fixed before our next CocoaPods release.
Duplicate of #130.
@kevincon Awesome, thanks for the follow up :)
In line 803 ( https://github.com/gali8/Tesseract-OCR-iOS/blob/master/TesseractOCR/G8Tesseract.mm#L803 ) I get this error (EXC_BAD_ACCESS (code=1 ...) which I belive is caused by the
pixels
being emptied if that makes any sense.As a result, the OCR result comes back empty.