gali8 / Tesseract-OCR-iOS

Tesseract OCR iOS is a Framework for iOS7+, compiled also for armv7s and arm64.
http://www.nexor.it
MIT License
4.22k stars 949 forks source link

imageWithBlocks fix. Rotate the original image to the right or it sho… #260

Open sunshineo opened 8 years ago

sunshineo commented 8 years ago

…ws upside down.

It used to look like this for me. wrong

As you can see the boxes are at the right place. It is the image that is upside down. Unless I say "threshold" is true, then it is fine. threshold

So it seems that something was wrong with "self.image" orientation. After the change I made: right

sunshineo commented 8 years ago

Per @ws233 comment on another pull request

The issue is that nevermind of the orientation of the device, the pixels in the image are always located in the same order. Only the imageOriantation tells how to draw the image on the screen. imageWithBlocks doesn't consider the imageOriantation property of the image. So you'd better fix the drawing code there. In the case of the thresholding, the image is preprocessed for you automatically. And if I remember correctly, the preprocessing considers the imageRotation. Therefore you have a correct result after the preprocessing.

So I guess instead of blindly rotate, I need to check imageOriantation property.