I am having five types of objects (flower, building, face, pair of shoes and a car) in my object recognition and i need to classify these. Identifying through edges in this type of data set seems to be a valid and distinguishable approach. So i have used canny edge detector(read it somewhere as a good approach) to find the edges in the image. Now i want to use this edged image to classify my objects. But since i am new to image recognition, i really couldn't figure how should i be selecting the features from this edged image for classification.

  1. Will it be a good approach to use all the pixels in the image(after canny edge detector) as features to any ANN classifier, but i think that would give a lot of redundant features (as most of the image is black except the edges) and there might be a possibility to reduce these. Is there any algorithm to select appropriate features from the image formed after canny detector?

  2. Second possibility could be to use any feature matching algorithm that could calculate the distance of the pixels between training and test data set(both edged) and predict the result with minimum distance. This is my approach but not sure about any existing algorithm. So needed some help on this.

Also i tried considering CNN(since they intrinsically use the edged approach) but these seem to be really computationally expensive.


3 Answers 3


Your approach goes in the line of the popular histogram of gradients approach. See here and the corresponding Wikipedia entry. Now unless you have some already labelled data, training such a system is quite laborious. If possible, I would start by using some available implementation to experiment with, like the one offered by scikit-image.

There are some other features, like Linear Binary Pattern, but they're not as powerful as HOG. See in the module corresponding of scikit-image for a list of features and their implementations.

As for CNN, you should not need to extract any features. The system learns the features automatically. That is one of the nice properties of deep architectures. A huge number of papers show that these systems learn some edge oriented filters features (in the same line as the idea you are considering).

Note that these features do not consider color. That may be an interesting feature for you to consider. Or extract the features for each of the color channels.

Hope this helps.


If you are going to use edge detection, you will have to use distance transform to do the kind of classification you are thinking of. Once that is done you need to create a distance matrix between the test image(s) (ones without the label) and the training image(s) (ones with the label).

But may I suggest using HoG transform instead, or at least a Sobel filter instead of an edge detector. The Sobel filter at least is simple to implement in Matlab and I'm sure someone has implemented the HoG filter. The reason is simple: the edge detectors give you binary features and this in my opinion makes it harder to compare since it is not scale and position invariant.

Once the feature vector is done, choose a classifier (SVMs, CART, NN etc.) to classify into the classes.


Remember that when doing computer vision and image processing you should assure that all images are taken in the same conditions. Preliminary preparation of data (exposure, resizing, lighting, filtering etc.) dramatically reduces problems that might occur later.

  1. Yes, choosing image pixels as an input features seems to be a reasonable choice. Remember that for even a relatively small image the number of features grows very fast (i.e. 256 x 256 px image resutls in 65 536 features). Therefore some dimension reduction technique should be applied (i.e PCA). You might use Python scikit-learn library that provides all necessary tools.

  2. I'm not sure about the performance of your approach - if your dataset does not have a representative amount of images of each class it would probably fail. You could consider experimenting with other features obtained from Gray Level Co-ocurance Matrix (enables many useful metrics, but your image should be represented in gray scale) or Zernike Moments to describe objects/shapes in an image (more info here).



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.