Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform Auto crop for document Recognize image using camera? [closed]

Tags:

I want to make a an application like a cam scanner for cropping a document.

But I need same functionality like my two images..

First Images shown image captured by camera..

enter image description here

Second image recognize a captured image part like this..

enter image description here

I research more and more but not getting any out put so, I ask here if,any one done this tell me..

Thanks

like image 643
Roadies Avatar asked Oct 30 '13 10:10

Roadies


1 Answers

I assume your problem is to detect the object to scan.

Object detection mechanisms like pattern matching or feature detection won't bring you the results you are looking for as you don't know what exactly is the object you are scanning.

Basically you search for a rectangular object in the picture.

A basic approach to this could be as following:

  • Run a canny edge detector on the image. It could help to blur the image a bit before doing this. The edges of the object should be clearly visible.

  • Now you want to do a Hough transform to find lines in the picture.

  • Search for lines with an angle around 90deg to each other. The problem would be to find the right ones. Maybe it is enough to use the lines closest to the frame of the picture that are reasonably parallel to them.

  • Find the intersecting points to define the edges of your object.

At least this should give you a hint where to research further.

As further steps in such an app you will have to calculate the projection of the points and do a affine transform of the object.

I hope this helps.

After writing all this i found this post. It should help you lot.

As my answer targets OpenCV you have to use the OpenCV library. In Order to do this, you need to install the Android Native Development Kit (NDK). There are some good tutorials on how to use OpenCV on Android on the OpenCV for Android page.

One thing to keep in mind is that almost each function of the Java wrapper calls a native method. That costs lots of time. So you want to do as much as possible in your native code before returning your results to the Java part.

like image 158
Grey Avatar answered Oct 06 '22 01:10

Grey