Tesseract-OCR-iOS icon indicating copy to clipboard operation
Tesseract-OCR-iOS copied to clipboard

Tesseract OCR not giving correct text from camera image for iOS platform

Open shreyasbellary opened this issue 8 years ago • 3 comments

Hi, I downloaded sample code given on github and try to take photo from camera for iOS platform . Image taken from camera has text but result got wrong from this library. Its giving correct text from image which is added in application bundle but whatever photo taken from camera its giving wrong text.

Please fix this issue.

Thanks

shreyasbellary avatar Sep 09 '16 11:09 shreyasbellary

It looks like the main reason is the actual "Template Framework Project" rotates by 180% the image. I will do a pull request with the fix soon, in the meanwhile you can test it taking the picture while rotating your phone by 180% (upside down).

raynor85 avatar Feb 14 '17 22:02 raynor85

Hi, Seem, this issue still exit. Please fix it. Thank you!

keohoangphuong avatar May 25 '17 10:05 keohoangphuong

This may be solved by passing along the image orientation at every image type conversion (like CGImage to UIImage etc). I've added an extension to handle this on my conversions from UIImage to CGImage like this: extension UIImageOrientation { func getCGOrientationFromUIImage() -> CGImagePropertyOrientation { // call on top of UIImageOrientation to obtain the corresponding CGImage orientation. // This is required because UIImage.imageOrientation values don't match to CGImagePropertyOrientation values switch self { case .down: return .down case .left: return .left case .right: return .right case .up: return .up case .downMirrored: return .downMirrored case .leftMirrored: return .leftMirrored case .rightMirrored: return .rightMirrored case .upMirrored: return .upMirrored } } } The thing is: UIImageOrientation.up may correspond to different raw values of CGImagePropertyOrientation.up. This is why this becomes an issue. I was previously getting all of my photos rotated by 90 degrees without specifically applying any transforms to them. This solved it. Good luck!

agu3rra avatar Oct 10 '17 19:10 agu3rra