# Histogram Of Oriented Gradient (HOG) – FEATURE MATCHING

As we have discussed HOG: Calculating Image Features in detail in my previous blog. We understood the basic concept behind HOG and all the steps of implementation of HOG in detail. Today we will discuss Feature Matching using HOG.

After the implementation of all the steps of HOG, we get a vector which is basically a featurevector of that image.

The total number of features obtained from the HOG are quite large in number.

Like in the previous blog, we obtained the HOG feature vector of size 3780, which is a quite big number.

These are the total number of features obtained from an image.

Now suppose you have to match two similar or dissimilar images to check the similarity between both.

How will you do it? Obviously, you will try to find out something common between them and according to that, you can tell whether these two images have something common in them or not.

Now the question is, how do we compare both images? What should be the parameters to decide the similarity between them?

Here we will be matching the HOG features of one image to another.

For that, we have to compare only those features which are relevant because comparing all 3780 features makes it more complex and costly.

Complex because why compare all the features with all others if you can get the result by comparing some of them.

Now the question arises is how to filter the features? How to connect or relate the feature from one image to another?

I’ll start by relating the features of an image to another image.

As discussed in the previous blog , we have divided an image into multiple blocks and drawn histograms for each block.

So here we will compare each block of an image to all the blocks of some defined region in another image and calculate the similarity score.

Now the most similar block for all the blocks an image are calculated using the similarity score. In this way, you have completed one task of relating the features of an image to another image.

Now how to get the most relevant features of an image???

Well !!! For that, you have to filter the features according to the most similar features and the least similarity error.

The features will be filtered easily as we already have all the data of similarity. From that, we can calculate the similarity error too.

Now we have the features which are the most relevant to compare.

So this is how feature matching of HOG features can be done. As the gradient of an image is one of the most important features of an image, so matching the HOG features will give tremendous results.

You can build a model and train it on multiple images with similar features found in other images. Using this model you can easily find out if images are similar or not.

If yes, then what are the common features in them. It is basically like a feature matcher.

Here we will not discuss the details of a model like what should be used and whatnot.

Today you have learned a new technique of feature matching using HOG, which is not generally used.

It gives very good results when the images are not of good quality.

In such cases, other pre-defined feature matches do not give very good results.

Here HOG feature matcher comes to the picture.

So you have learned a very new and great concept.