What algorithm can i use to refine image selection mask? - android

I need an algorithm to be able to contrast detect edges in a photo.
Users will roughly paint the mask over an object in an image with their fingers on android phone and then i want to refine the selection mask with the code that detects the edges and adjusts the mask to the edges.

please read about hough transform also canny and you can decide which are better/
this not an easy thing to do.
i would suggest you try to understand how do they work with matlab first this is very C-like language.
http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html

Related

OpenCV image processing in android

Please check out the image links and can you please suggest the best possible way to detect the ball in the image? I tried edge detection with contours, hough circles and most of the regular ways probably but I get too much background noise.
Can someone please suggest a way to detect the ball in both of the linked images?
https://i.stack.imgur.com/zuLa7.jpg
http://imgur.com/a/nsOSU
Sure.
I have detected the colored object with HSV feature before.
I converted RGB image to HSV image and then detect the object with using the range of hue for the target color.
After threshold with range of hue(inrange), find contour function of OpenCV was used.
In this case, the color detection would be useful rather the shape features.
I have worked such project before, and I have solved this in HSV space.
At first, I converted the image from RGB to HSV.
And then create binary image with threshold function for target color range.
At last, located the position of object(ball) with Hough Circle detect function.
Please check follow, it would be help you, I think:
http://www.pyimagesearch.com/2014/08/04/opencv-python-color-detection/
Thanks.

OpenCV android : Hough transform rectangle recognition with image with multiple different sized rectangles

So everyone, my first question on stackoverflow.
I have been working with android and openCV for a month and I was able to successfully implement template Matching. Now, the next task is to detect all the rectangles in the image and get the coordinates (I actually want the color of every rectangle) for research purposes. Kindly help. I tried using Hough transform with canny edge detection but unfortunately it doesn't detect the small rectangles which is the primary concern now.
Thank you!![![Have to detect all the rectangles, small and big ones
So I'm really proud to post an answer to my own question. Hope this helps someone in future. There are obviously a lot of ways to do this but the most accurate way was to use template matching on the main image to find the coordinates of the biggest rectangle and since all the other rectangles are equidistant to the corner points, center of every rectangle can be found which gives the desired colors.
The thin strip in the middle was also recognized by template matching and then a gradient operator represented the various rectangles, every peak in the gradient represents the rectangles.
Kindly comment for code. For research purposes I cannot post to anonymous.

Detect eye ball

I am developing an app which will change the color of your eye. I need some help about detecting eye ball. Currently i have a selector that will be used to reduce ROI. It look like
this
So who we can detect eye ball from that selected region. I was thinking about changing the image to grayscale and then detect big black spot from that and then change color of it which will be the next step. i'll really appreciate any help.
Your way of thinking about a returning pattern is a good start. I am doing some work on a pattern recognition chair as well, so here is some help for your task:
using a grayscale is a good start btw ;)
There are some "facts" that are always applicable to a non pathologic eye:
the center is dark
left and right side surrounding dark ball are almost white (depends on how open the eye is)
do not forget: you have 2 eyes. link them together in some way (usually they are on an approximately horizontal line)
there is usually motion in the eyes while the other regions of the picture are relatively calm
Of course I cannot provide any code here, this would blast this whole post, but I hope I could help you in some way.
I found some link these guys detecting pupil of the eye. May b this will help you . See here and here
you could use the template matching method from open cv. template matching
this will help you find the eye in most of the cases.
Another solution would be to convert your image into an edge image with e.g. canny edge detector from opencv. and then search for this pattern with the template matcher. Using the edges makes you independent of the color. Using grayscale images will also facilitate the procedure.

Optimize an image for text recognition using tesseract

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:
Detect the objects in the resized image.
Once the object is identified, compute its border w.r.t original image. (This is for removing the camera angle effect)
Extract the object from original image, by applying perspective transform.
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...
That's a lot you are asking for, and depending on the object may be impossible. You should check out the tutorials on 2D feature detection and object detection (http://docs.opencv.org/doc/tutorials/features2d/table_of_content_features2d/table_of_content_features2d.html and http://docs.opencv.org/doc/tutorials/objdetect/table_of_content_objdetect/table_of_content_objdetect.html) to see if there is something you can use.
White balance does not do anything to lighting, you should do adaptive thresholding or some kind of high pass filtering instead.

Comparing gestures/images in Android

What would be the best way to compare a gesture made on an Android device's screen with a stored gesture? For example, if in my application, I want it so that if I draw a triangle with my finger, the screen will turn blue, and if I draw a circle, the screen will turn red, how could that be done? The only thing I have been able to think of so far is to somehow generate an image file and then compare that to an image of a triangle or circle and check for similarities. But that wouldn't really account for different sized shapes or offset ones. Any ideas on how this could be implemented? Thanks!
There is no need to compare/match the shape of a gesture with an image. The better way is to mathematically guess which one of the recognized shapes did the user draw. http://developer.android.com/resources/articles/gestures.html provides a great reference for implementing gestures.
HTH,
Akshay

Categories

Resources