Ask Your Question
0

detect all objects in real-time with Android

asked 2013-02-19 04:27:20 -0600

Marwen Z gravatar image

after I made ​​the examples such as face detection, is that I have the possibility to detect all objects of any type without giving a characterization ? otherwise all objects in a closed contour? then identify these objects (given their id)

edit retag flag offensive close merge delete

Comments

I think you will have to be more specific about what it is you want to do. Perhaps give an example :)

ubehagelig gravatar imageubehagelig ( 2013-02-19 07:01:36 -0600 )edit

@ubehagelig Hi, from a video scene (Android) I detect an object and saves it in my database, which amounts to saying using "get the touch begin position (x, y)" and then use methods 'OpenCV to collect this object or its contour.

Marwen Z gravatar imageMarwen Z ( 2013-02-21 04:06:41 -0600 )edit
1

@Marwen-Z, @Mathieu-Barnachon : This is not a forum, but a Q&A site. That means, one question and some answers. Discutions are not allowed in the Answer. Comments should clarify the question, and any changes to question should be made by editing it. If you have a new, subsequent question, you MUST open a new question.

sammy gravatar imagesammy ( 2013-02-25 10:00:29 -0600 )edit

I agree with sammy. But I also think this site lacks some "visible" guidelines for new users.

SR gravatar imageSR ( 2013-02-25 13:54:08 -0600 )edit

3 answers

Sort by » oldest newest most voted
3

answered 2013-02-22 12:19:07 -0600

updated 2013-02-26 01:21:05 -0600

The silhouette or contour would be a bad idea: when you move the contour is changing! You can try interest points (SIFT/SURF/etc.) and compare the descriptors obtain. The results will depended on objects (texture, size, etc.). If your object are different in colors, you can used histograms comparisons. Otherwise, maybe you have to train a classifier (SVM,...) with the objects you want recognized, using critical points or whatever you want. See the literature about objects recognition to have ideas.

[Update] To find if the pixel is inside a contour: draw each contour with a different color, get the color of selected pixel by user => if the pixel is white, it is outside any contour, otherwise, you know the contour (one for the first, two for the second, etc. as you have specified in drawContour). After, your algorithm is fine (draw the contour, get the bounding box of your contour to set the ROI, return only the silhouette of object). Try to display image at each step to debug...

edit flag offensive delete link more

Comments

Please edit your answer if you want to add something. Multiple answers are discouraged - and forum-like discussion is completely disallowed. http://answers.opencv.org/question/1038/how-to-handle-inappropriate-editing-habits/

sammy gravatar imagesammy ( 2013-02-25 10:03:44 -0600 )edit
1

I've edited my previous answer. Thank for the advice, you're right, multiple answers are not a good idea. My apologies.

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-02-26 01:22:27 -0600 )edit
1

answered 2013-03-18 10:04:44 -0600

I would like to add to the topic that face detection uses a cascade of weak classifiers, invented by Viola Jones, which is not a recognition of faces! This is a big difference. When you know the actual object, recognition can be done as suggested. However, when you do not know the actual object, but just the object class, the training of a model needs to be done.

A nice guide to this can be: http://docs.opencv.org/doc/user_guide/ug_traincascade.html?highlight=train%20cascade

edit flag offensive delete link more
0

answered 2013-03-18 06:08:03 -0600

Marwen Z gravatar image

updated 2013-03-19 07:36:01 -0600

@Mathieu Barnachon
je réalise un projet android pour la reconnaissance d'un objet connu img1 voici les étapes :

descriptors = new Mat();
keypoints = new MatOfKeyPoint();
detector = FeatureDetector.create(FeatureDetector.ORB);
detector.detect(img1, keypoints);
descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);
descriptor.compute(img1, keypoints, descriptors);
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);


ColorDetection.cvt_YUVtoRGBtoHSV(mYuv,mGraySubmat);
MatOfKeyPoint mKeyPoints = new MatOfKeyPoint();
MatOfDMatch  matches = new MatOfDMatch();

detector.detect(mGraySubmat, mKeyPoints);
descriptor.compute(mGraySubmat, mKeyPoints, mIntermediateMat);
Log.i("matches", matches.size()+"");
matcher.match(mIntermediateMat, descriptors, matches);
Log.i("matches", matches.size()+"");

mIntermediateMat2.create(resultSize, CvType.CV_8UC1);

Features2d.drawMatches(img1,  keypoints , mGraySubmat, mKeyPoints, matches, mIntermediateMat2);

Imgproc.resize(mIntermediateMat2, mIntermediateMat2, mRgba.size());
Imgproc.cvtColor(mIntermediateMat2, mRgba, Imgproc.COLOR_RGBA2BGRA, 4);
Utils.matToBitmap(mRgba, bmp);

when the last steps Features2d.drawMatches the application is not responding (I tested well) my question is: when I extract matches (MatOfDMatch) I want to draw just the keypoints of image source in the scene video as shown in this link but I can not translate properly in java http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography

when I get to the stage of drawing, I just want to draw a square, for example, the object recognition

edit flag offensive delete link more

Comments

You could do it manually: transform your MatOfKeypoints to an array of Keypoints (with toArray), and iterate through the Point field of keypoints (.pt) and draw rectangle/circle/whatever you want with pt.x and pt.x.

But maybe this should be another question, to have more relevant answers.

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2013-03-19 07:40:47 -0600 )edit

yes i created another question here http://answers.opencv.org/question/9532/locate-the-object-recognition-android-opencv/
but i want to transform MatOfDMatch not MatOfKeypoints, i want to do like this example http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography but not working in Java

Marwen Z gravatar imageMarwen Z ( 2013-03-19 08:24:05 -0600 )edit

@Mathieu Barnachon how can i superimpose object 3d in recognized object please guide me

Marwen Z gravatar imageMarwen Z ( 2013-04-29 05:36:02 -0600 )edit

Question Tools

Stats

Asked: 2013-02-19 04:27:20 -0600

Seen: 4,258 times

Last updated: Apr 16 '13