rmtheis / android-ocr

Experimental optical character recognition app
Apache License 2.0
2.22k stars 894 forks source link

Portrait Orientation #4

Closed arjunvasan closed 12 years ago

arjunvasan commented 12 years ago

Hey rmtheis,

Thanks for your awesome prototype ocr app! I've been using it to figure out how to get tesseract working on android. I have a ee signal processing background, and I'm kind of new to android.

What are the changes needed using your source to switch to portrait mode? I'm sure you have lots of your own stuff to deal with, but if you have a minute I'd appreciate the help! How is it that the camera preview appears orthogonal to reality?

Thanks Arjun

rmtheis commented 12 years ago

You're welcome! To change to portrait mode, I think all you need to do is to take out the android:screenOrientation="landscape" directive in AndroidManifest.xml. You might possibly also need to adjust the viewfinder box in getFramingRect() in CameraManager.java.

Right now I have it locked to landscape mode because that seems to better cover horizontal text. Robert

On Sun, Apr 8, 2012 at 10:11 PM, arjunvasan < reply@reply.github.com

wrote:

Hey rmtheis,

Thanks for your awesome prototype ocr app! I've been using it to figure out how to get tesseract working on android. I have a ee signal processing background, and I'm kind of new to android.

What are the changes needed using your source to switch to portrait mode? I'm sure you have lots of your own stuff to deal with, but if you have a minute I'd appreciate the help! How is it that the camera preview appears orthogonal to reality?

Thanks Arjun


Reply to this email directly or view it on GitHub: https://github.com/rmtheis/android-ocr/issues/4

arjunvasan commented 12 years ago

Hey Robert,

Thanks for your help. So right now it's previewing in portrait mode, and i set the viewfinder rectangle to the appropriate dimensions. However the OCR seems to be treating the bitmap it's fed as if it were still in landscape. If the viewfinder is over one line of text, the bounding boxes seem to identify each letter as it's own line of text. Suggestions?

Thanks so much, Arjun

On Sun, Apr 8, 2012 at 11:03 PM, Robert Theis < reply@reply.github.com

wrote:

You're welcome! To change to portrait mode, I think all you need to do is to take out the android:screenOrientation="landscape" directive in AndroidManifest.xml. You might possibly also need to adjust the viewfinder box in getFramingRect() in CameraManager.java.

Right now I have it locked to landscape mode because that seems to better cover horizontal text. Robert

On Sun, Apr 8, 2012 at 10:11 PM, arjunvasan < reply@reply.github.com

wrote:

Hey rmtheis,

Thanks for your awesome prototype ocr app! I've been using it to figure out how to get tesseract working on android. I have a ee signal processing background, and I'm kind of new to android.

What are the changes needed using your source to switch to portrait mode? I'm sure you have lots of your own stuff to deal with, but if you have a minute I'd appreciate the help! How is it that the camera preview appears orthogonal to reality?

Thanks Arjun


Reply to this email directly or view it on GitHub: https://github.com/rmtheis/android-ocr/issues/4


Reply to this email directly or view it on GitHub: https://github.com/rmtheis/android-ocr/issues/4#issuecomment-5021364

slashuer commented 12 years ago

@rmtheis I have been studying your code , because I am making an app that uses OCR. I noticed you had a light in the preferences does it not work something. because I wrote some good light code, so can I implement a light in here for you?

also: do you have any Idea how I could fix one side of the view Rect so that it does not cross under the shutter button? PS: sorry for writing in the wrong area, You don't have a way to message you.

rmtheis commented 12 years ago

Hmm...sorry...my CRS disease is affecting me. Try setting the "portrait" boolean when you call findBestPreviewSizeValue() in CameraConfigurationManager. Also remove the hard-coded landscape values in initFromCameraParameters(). Let me know if that works. Robert

On Mon, Apr 9, 2012 at 2:45 PM, arjunvasan < reply@reply.github.com

wrote:

Hey Robert,

Thanks for your help. So right now it's previewing in portrait mode, and i set the viewfinder rectangle to the appropriate dimensions. However the OCR seems to be treating the bitmap it's fed as if it were still in landscape. If the viewfinder is over one line of text, the bounding boxes seem to identify each letter as it's own line of text. Suggestions?

Thanks so much, Arjun

On Sun, Apr 8, 2012 at 11:03 PM, Robert Theis < reply@reply.github.com

wrote:

You're welcome! To change to portrait mode, I think all you need to do is to take out the android:screenOrientation="landscape" directive in AndroidManifest.xml. You might possibly also need to adjust the viewfinder box in getFramingRect() in CameraManager.java.

Right now I have it locked to landscape mode because that seems to better cover horizontal text. Robert

On Sun, Apr 8, 2012 at 10:11 PM, arjunvasan < reply@reply.github.com

wrote:

Hey rmtheis,

Thanks for your awesome prototype ocr app! I've been using it to figure out how to get tesseract working on android. I have a ee signal processing background, and I'm kind of new to android.

What are the changes needed using your source to switch to portrait mode? I'm sure you have lots of your own stuff to deal with, but if you have a minute I'd appreciate the help! How is it that the camera preview appears orthogonal to reality?

Thanks Arjun


Reply to this email directly or view it on GitHub: https://github.com/rmtheis/android-ocr/issues/4


Reply to this email directly or view it on GitHub: https://github.com/rmtheis/android-ocr/issues/4#issuecomment-5021364


Reply to this email directly or view it on GitHub: https://github.com/rmtheis/android-ocr/issues/4#issuecomment-5034617

rmtheis commented 12 years ago

@slashuer Thanks for the offer--I appreciate it. Yeah, I had a light toggle button in there for a while, but it seemed to reduce OCR quality much more than it actually helped, so I prefer to leave it out. (It also generated a bunch of error reports that obscured errors that I'm more interested in seeing.)

I'm not sure offhand how to best limit the rect size. You could limit the size of the rect in onTouch() in CaptureActivity based on the size of the shutter button on the user's device. A better solution would be to animate the movement of the shutter button off-screen temporarily while the rect is in the way.

arjunvasan commented 12 years ago

Hey Robert,

Thanks again for your work on porting tesseract to android. I'm currently working on a startup that is going to use tesseract on both android and iphone. We were just funded by YCombinator and Highland capital, so now it's getting serious. I was wondering if you had some time to help us understand and utilize tesseract optimally. A couple hours would be more than enough.

Thanks! Arjun

On Tue, Apr 10, 2012 at 11:05 PM, Robert Theis < reply@reply.github.com

wrote:

@slashuer Thanks for the offer--I appreciate it. Yeah, I had a light toggle button in there for a while, but it seemed to reduce OCR quality much more than it actually helped, so I prefer to leave it out. (It also generated a bunch of error reports that obscured errors that I'm more interested in seeing.)

I'm not sure offhand how to best limit the rect size. You could limit the size of the rect in onTouch() in CaptureActivity based on the size of the shutter button on the user's device. A better solution would be to animate the movement of the shutter button off-screen temporarily while the rect is in the way.


Reply to this email directly or view it on GitHub: https://github.com/rmtheis/android-ocr/issues/4#issuecomment-5062734

akorentlab commented 9 years ago

@slashuer can i please have your code for light? please reply soon