Tesseract-OCR-iOS
Tesseract-OCR-iOS copied to clipboard
Tesseract OCR not giving correct text from camera image for iOS platform
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
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).
Hi, Seem, this issue still exit. Please fix it. Thank you!
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!