Search code examples
pythonopencvdistancefeature-extractionfeature-descriptor

comparing HOG feature vectors without SVM


I am relatively a newbie to computer vision and now currently doing a learning project on shape detection where I have a fixed region of interest(ROI) in all the images where the object is most likely present and I have to compare their shapes to give whether the object present in two input images are same or not.There are slight translational and scale changes and illumination changes.

I am trying to compare the shape of the object between two input images and trying to provide an output value describing their similarity. If the similarity is above a certain threshold, I can tell that the same object is present in both input images.

I have tried contours, but it does not give reliable results(thresholding either gives too many details or misses some vital details) and doesn't generalize well to all images. I am thinking of using global shape descriptors like HOG.

But I have problems with understanding the feature vector values from the HOG descriptor. How to compare HOG feature vectors(1D) for the two input images to find similarity without using SVM or machine learning? What is the best way to compare HOG feature vectors?

I don't understand how the distance measures work for comparing the future vectors. I want to understand the physical meaning of how distances are used to compare feature vectors and histograms? How to use them to compare HOG feature vectors?


Solution

  • Sorry, your question is actually hard to understand. I think you are going into wrong direction.

    How to compare HOG feature vectors(1D) for the two input images to find similarity without using SVM or machine learning? 
    

    SVM is tool for comparing a vector with a dictionary to find the rightest answer. For similarity, it is just the distance of the two image-represented vector. Do not overthinking, it will kill you

    In your case, you use HOG feature as your image-represented vector. So calculate the Euclid distance between them. That value is there similarity.

    You can see matlab pdist method to find a list of easy-to-used distance calculating method.

    The problem lie down here is not how to compare feature vector, it is how to represent your image by single vector. A better image represent lead to better performance. For example: Bag-of-word, CNN, etc . There are ton of them, for newbie like you start with Bag-of-word.

    Hope that help and welcome to Computer vision world