Android auto crop camera captured images - android

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

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 :)

Use OpenCV for android.
You can use the Watershed (Imgproc.watershed) function to segment the image into foreground and background. Then you can crop around the foreground (which will be the document).
The watershed algorithm needs some markers pre-defining the regions. You can for example assume the document to be in the middle of the image, so create a marked region in the middle of the image to get the watershed algorithm started.

Related

Real time mark recognition on Android

I'm building an Android app that has to identify, in realtime, a mark/pattern which will be on the four corners of a visiting card. I'm using a preview stream of the rear camera of the phone as input.
I want to overlay a small circle on the screen where the mark is present. This is similar to how reference dots will be shown on screen by a QR reader at the corner points of the QR code preview.
I'm aware about how to get the frames from camera using native Android SDK, but I have no clue about the processing which needs to be done and optimization for real time detection. I tried messing around with OpenCV and there seems to be a bit of lag in its preview frames.
So I'm trying to write a native algorithm usint raw pixel values from the frame. Is this advisable? The mark/pattern will always be the same in my case. Please guide me with the algorithm to use to find the pattern.
The below image shows my pattern along with some details (ratios) about the same (same as the one used in QR, but I'm having it at 4 corners instead of 3)
I think one approach is to find black and white pixels in the ratio mentioned below to detect the mark and find coordinates of its center, but I have no idea how to code it in Android. I looking forward for an optimized approach for real-time recognition and display.
Any help is much appreciated! Thanks
Detecting patterns on four corners of a visiting card:
Assuming background is white, you can simply try this method.
Needs to be done and optimization for real time detection:
Yes, you need OpenCV
Here is an example of real-time marker detection on Google Glass using OpenCV
In this example, image showing in tablet has delay (blutooth), Google Glass preview is much faster than that of tablet. But, still have lag.

Scan for Object with Android Camera

I need to scan a special object within my android application.
I thought about using OpenCV but it is scanning all objects inside the view of the camera. I only need the camera to regognize a rectangular piece of paper.
How can i do that?
My first thought was: How do barcode scanners work? They are able to regognize the barcode area and automatically take a picture when the barcode is inside a predefined area of the screen and when its sharp. I guess it must be possible to transfer that to my problem (tell me if im wrong).
So step by step:
Open custom camera application
Scan objects inside the view of the camera
Recognize the rectangular piece of paper
If paper is inside a predefined area and sharp -> take a picture
I would combine this with audio. If the camera recognized the paper make some noice like a peep or something and the more the object is fitting the predefined area the faster the peep sound is played. That would make taking pictures for blind people possible.
Hope someone got ideas on that.
OpenCV is an image processing framework/library. It does not "scan all objects inside the view of the camera". By itself it does nothing and yet it gives the use of a number of useful functions, many of which could be used for your specified application.
If the image is not cluttered and nothing is on the paper, I would look into using edge detection (i.e. Canny or similar) or even colour blobs (even though colour is never a good idea, if your application is always for white uncovered paper, it should work robustly).
OpenCV does add some overhead, but it would allow you to quickly use functions for a simple solution.

Android - Capture and convert objects from Pictures to Canvas

When taking a picture of an object (for example, a Window). Is it possible to capture the outline of a window and display the contents on the canvas.
For example,
and convert this picture of the window and displays it on the Android display
Any help or pointers to tutorials would be greatly appreciated,
an edge detection algorithm is what you want. As Renard said, this can be simple providing your input is simple like the window. Complex imagery is much harder to find edges on.
You might cruise through the Open Computer Vision library (OpenCV) to see if there's something there you can use algorithmically

Toy Camera filter for Android Image Processing

I have a small Android app I am building to apply filters/effects on a picture taken from the camera or from the image gallery. So far I have blur, sepia, emboss, b&w, contrast, etc. However, the one I am looking for seems to be hard to find using google. I would like to apply the toy camera effect as well. I see a lot of Android apps doing this, but I can't find the algorithm to implement to Android.
Does anyone know how I can achieve this?
As #You said above the toy camera effect is more than likely a number of adjustments. In my experience you should look into adding a vignette (http://en.wikipedia.org/wiki/Vignetting) and emulating E6/C41 cross processing. Cross-processing can be easily achieved by manipulating the individual RGB channel such as the curves shown here http://www.reynsphoto.com/articles/Post_Processing/html/Digital_cross-processing_C-41_as_E-6.php. Furthermore, you can add a slight yellow tint.
hope this helps

which java library to use to modify a camera picture?

I'm currently looking into creating an app that takes a picture using the phone's camera. The app will be used for clients that are pre-op for breast augmentation. The user will be able to take a picture of themselves then place two shperes over the picture, then with a slidebar manipulate the size of the spheres. This will give the user an idea which cup size they would like. I understand that there is something in photoshop that has the desired effect and this is what i'm trying to replicate but on the bitmap image.
Are there any suitable libraries out there that i can use. I'm looking into OpenGL as that is for 3D graphics.
Any ideas and input would be appreciated.
thanks Mat.
Java does have it's own 2D and 3D APIs. Hopefully you can these to achieve your goal?

Categories

Resources