Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android auto crop camera captured images

I am looking for some kind of auto trim/crop functionality in android. Which detects a object in captured image and creates a square box around object for cropping. I have found face detection apis in android, but my problem is captured images are documents/pages not human faces so how can I detected documents or any other object from captured picture.

I am thinking of any algorithms for object detection or some color detection. Is there any apis or libraries available for it.

I have tried following link but not found any desired output.

Find and Crop relevant image area automatically (Java / Android)

https://github.com/biokys/cropimage

Any small hint would also help me alot. Please help. Thanks in advance

like image 731
Dory Avatar asked May 31 '13 06:05

Dory


People also ask

Can Google Photos auto crop?

The app will determine when you are viewing a photo of a document and then suggest you use the new auto-cropping tool. The tool will also automatically rotate the image if necessary and also brighten it up a bit for clarity.

What is auto crop?

The Auto Crop node adjusts the Input so that its content is either placed at the center of the image without being resized, or resized to the span of the image.

How do I Auto crop a picture?

Rather than using the Crop tool, go to Image > Trim. The Trim command enables you to automatically crop your image by trimming transparent pixels or by trimming the color of the pixel in the top left or bottom right corner of your image. You can also choose which sides of your image you would like to Trim.


1 Answers

That depends on what you intend to capture and crop, but there are many ways to achieve this. Like littleimp suggested, you should use OpenCv for the effect.

I suggest you use edge-detection algorithms, such as Sobel, and perform image transformation on it with, for example, a Threshold function that will turn the image into a binary one (only black and white). Afterwards, you can search the image for the geometric shape you want, using what's suggested here. Filter the object you want by calculating the detected geometric figure's area and ratio.

It would help a lot to know what you're trying to detect in an image. Those methods I described were the ones I used for my specific case, which was developing an algorithm to detect and crop the license plate from a given vehicle image. It works close to perfect and it was all done by using OpenCV.

If you have anything else you'd like to know, don't hesitate to ask. I'm watching this post :)

like image 108
Rafael Matos Avatar answered Sep 20 '22 16:09

Rafael Matos