1

I'm trying to make a small Android application that reads text from pictures. I've already implemented Tesseract tools for Android and I'm able to recognize text from pictures taken with camera. My current problem is that distance for taking picture is really strict. It's not really user friendly if users has to be at very exact distance from text (s)he's trying to read.

I was thinking that best way would do it like in Google Goggles where user is able to crop specific part of image (on camera preview) that (s)he likes to scan. Is there any ready custom cameras (couldn't find any) or have any of you done it?

Thanks, Lasse

Lasse
  • 11
  • 1
  • 2
  • Maybe is better to implement autofocus on camera to let the users use it from any reasonable distance. – Fernando Gallego Jul 24 '12 at 10:04
  • Problem is not losing the focus, problem is that if user wants to scan a specific text, (s)he has to take picture from distance when there's nothing but wanted text on the image. If user takes picture from too far away, Tesseract will find all kind of unwanted *hit from the picture. – Lasse Jul 24 '12 at 11:39
  • I don't know how tesseract works but maybe you should take only a part of the image, a rectangle in the center for instance, in your processing code and make an overlay over your camera preview that lets the user know which part of the image are you taking into account. onPreviewFrame you can crop the image with the same rectangle and pass it to tesseract – Fernando Gallego Jul 24 '12 at 12:23
  • Well that is exactly what I'm trying to get help for. I could do it like it's done in [Barcode Scanner](http://i.stack.imgur.com/CQ9Dq.png) but it wouldn't remove the original problem: user has to stand at exact distance from text (s)he wants to scan. It would be much much better solution to do it like it's done in Google Goggles: user can determine that area manually. It doesn't matter if user is standing three feet or ten feet from the text, (s)he can point camera at target, select text area manually and then "take the photo". – Lasse Jul 24 '12 at 12:53
  • Ok, thenk you will need to create a custom view over your camera preview, override onTouch method and capture the x and y coordinates when the event action is action_down and again when the event is action_up, with that two points you have your rectangle and you can crop the image with them as it will be the user selection. More or less. – Fernando Gallego Jul 24 '12 at 13:03

3 Answers3

0

I'd figure that looking at the ZXing source code may be your best option. It has a specific focal point where it focuses on the main area of the bar code.

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
0

The Android camera app has cropping code, it doesn't have many dependencies and it is fairly straightforward to integrate in your app. Checkout AOSP code and try it out.

Nikolay Elenkov
  • 52,576
  • 10
  • 84
  • 84
  • If I understood correctly, camera app gives user possibility to crop image after it's taken. I'm looking for solution like used in Google Goggles, where users can first select wanted area from camera preview, then take the picture, and then application will scan only the selected area. – Lasse Jul 24 '12 at 11:40
  • 1
    Right. But it is doing the same thing actually -- the camera can only take pictures in a predefined set of sizes, you can't just select the size at runtime. So Googles takes the picture, crops it and the does OCR/whatever magic. They just make it look better by letting you crop in advance. – Nikolay Elenkov Jul 24 '12 at 13:47
0

I have the same problem in my application.

Here (Crop image ala Google Goggles) you can find a solution but it is not so "clean" like I would, so I'm still looking for something better.

EDIT: Found it! http://adblogcat.com/a-camera-preview-with-a-bounding-box-like-google-goggles/

Community
  • 1
  • 1
Yuri
  • 365
  • 6
  • 13