Ask Your Question
1

Optimize image using opencv

asked 2013-04-05 03:03:56 -0600

anz gravatar image

updated 2013-04-05 03:56:01 -0600

I have user tesseract ocr for my android project to recognize text from an image taken from the camera. But the results are not accurate. I want to optimize the image using opencv. I want to achieve the following for the captured image which is decoded in Bitmap.Config.ARGB_8888 format:

  1. Detect the objects in the resized image.
  2. Once the object is identified, compute its border w.r.t original image. (This is for removing the camera angle effect)
  3. Extract the object from original image, by applying perspective transform.
  4. Apply white balance to remove lightening effects.

In the example provided by with the tess_two api, they are using Leptonica for the image manipulations like drawing the bounding boxes around the words..But in my case I want to use OpenCV...Your guidance will be highly appreciated...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-04-05 04:02:51 -0600

I want to point out that what you are trying is not that straightforward as you might think. But hey, this are the steps to follow.

  1. Train a cascade classifier using train_cascade, or create an object classifier using the SVM functionality openCV provides. This way you retrieve an object model able to detect your object in given input ranges.
  2. Use model to detect objects, which returns you the bounding box, but not the exact boundaries.

http://docs.opencv.org/doc/user_guide/ug_traincascade.html?highlight=train%20cascade

This is problem 1, how will you segment the boundaries. You could try it with stuff like gradient detection (Sobel operators, Scharr operators) or the canny edge detector. Again this is all provided in OpenCV.

http://docs.opencv.org/doc/tutorials/imgproc/table_of_content_imgproc/table_of_content_imgproc.html#table-of-content-imgproc

Next you would need to define a binary image based on the edge with what is background and what is the object itself.

Extracting the object won't be to difficult, thats just cutting out the returning bounding box.

About the perspective transform, nothing I have done so far, so can't help you there. But this is probably enough to get you started.

edit flag offensive delete link more

Comments

1

Thanks for the guide..I will try these things out...

anz gravatar imageanz ( 2013-04-05 04:59:11 -0600 )edit

Question Tools

Stats

Asked: 2013-04-05 03:03:56 -0600

Seen: 1,251 times

Last updated: Apr 05 '13