I am trying to implement Canny edge detection found hereCanny edge to differentiate objects based on their shapes. I would like to know what are the features? I need to find a score/metric so that I can define a probability from information like mean of the shape. The purpose is to differentiate between objects of different shapes. So, lets assume that the mean shape(x) of Object1 and Object2 are x1,x2 and the standard deviation(s) is s1,s2 respectively. From what do I calculate these information and How do I find these information?
-
1It will be helpful if you can post an example image showing the objects you want to detect, and the background. Depending on these, it may or may not be possible to estimate the shapes. – Totoro Dec 06 '13 at 05:22
-
I can refer you to a paper on shape and contour descriptors, if you'd like. – GilLevi Dec 07 '13 at 19:15
1 Answers
Canny Algorithm is an edge detector. It searches for high frequencies in the image by computing the magnitude of the derivatives in x and y direction. In the end of you have contours of objects. What you are trying to do is to classify objects and using Canny does not sound like a right way to do it, I am not saying you cannot build features out of edges, but it might perform poorly.
In order to achieve what you want, you need first to identify what features are important for you. You mentioned the shape but is the color a good feature for the class of objects you are trying to find? Your pictures show very colorful objects. Are you only trying to distinguish one object to the other (considering the images only display only the object of interest) or do you want locate them in the screen? Does the image contain only one object or multiple ones?
I will give you some direction regarding feature modeling.
If color is a strong information for your objects, you could model your features using histogram information, compute n bins for all objects and store the distribution of the bins as a feature vector. You can use HOG.
Another possible (naive) solution is to compute all colors of patches (e.g. 7x7) belonging to each object and to compute later the histogram over patches instead of single pixels.
If you are not satisfied with color information and you would like to differentiate objects by comparing information in their neighborhood, you can use local binary patterns, which might be enough for the type of information you have.
Once you decide on the features which are important and modeled them, you can go for the classification (which is gonna determine which object you are seeing given a certain feature).
A probabilistic framework tries to estimate the posterior probability P(X|C), i.e. what is the probability of being object X given that we observed C (C could be your feature) and this is very powerful. You might consider reading about Maximum Likelihood Estimation and Maximum a posteriori. Also, a Naive Bayes classifier is a simple off the shelf algorithm available on Opencv that you could use.
You could use many other algorithms, such as SVM, Boost, Decision Trees, Neural Networks and so on. Bag of visual words is also a nice alternative.
If you are interested how to separate the object of interest from the background you are talking about image segmentation, you can look at K-Means or more powerfully Graph Cuts techniques. Of course you can always segment first and then classify the segmented blobs.
Samuel

- 1,329
- 1
- 10
- 23
-
Thank you for your detailed explanation. Based on your answer, I am thinking of using color, size and if possible shape. Which techniques should I use for size and shape feature extraction? Actually, I am using Robot Operating System (ROS) and OpenCV for robot image vision. During navigation, it needs to distinguish between different objects that belong to the class say "household items" and another class "workshop items". Based on the identified objects, a decision will be made and suitable action executed. Do you have any suggestions for pattern recognition in this application? – Srishti M Mar 06 '14 at 17:32
-
1I showed a whole pipeline of how to accomplish that. Try the Bag of words tutorial that I pointed out, it is very intuitive. – Sam Felix Mar 07 '14 at 10:12