Ask Your Question

Global image feature implementation

asked 2013-03-14 14:14:29 -0500

Shin gravatar image

Is there any OpenCV implementation of a global image features detector?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-03-14 14:47:08 -0500

Your question is kinda vague but, some of the possibilities are:

  • Using the color histogram or the grayscale histogram of an image and match that between images
  • You could use a histogram of oriented gradients by defining gradient directions and match that
  • You could define edges
  • ...

So basically what you want to do is template matching. For that you first define a global descriptor of an image - -

Then you match the result of your references with the input images and use a distance metric between both. Best match has closest distance, meaning it is the most equal one.

Google template based matching, you will find tons of examples.

edit flag offensive delete link more


@StevenPuttemans : Thank you for your answer. I'd like to use a global descriptor for a color image in combination with a global descriptor for a depth image (from which i can get a point cloud) and combine them in a single descriptor vector. My ultimate goal is to feed the descriptor vectors to a support vector machine. For this task, i want the descriptor to be scale and rotation invariant. Any suggestion?

Shin gravatar imageShin ( 2013-03-14 16:33:16 -0500 )edit

Good luck with that, there is no existance of a global scale and rotation invariant descriptor. That is why they created local descriptors, because the change in information locally is much smaller than globally. If you really want the global approach with the invariances, you could do a brute force approach, rotating your image over range of angles, then scaling your image over preset range, and apply color histogram based matching. But as I said, the reason why research went on with local feature matchers is this exact point!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-15 03:30:35 -0500 )edit

answered 2013-03-15 03:55:36 -0500

Guanta gravatar image

updated 2013-03-15 03:56:27 -0500

As Steven pointed out OpenCV doesn't have a global image descriptor. However you can use the local descriptors to form a local one. Please have a look at a previous answer by me at: , where you'll find more information how to achieve that. Good luck!

edit flag offensive delete link more


Guanta, just in an addition to your answer, this is indeed the best way to go, but there are still global descriptors available. Creating a simple intensity histogram of a grayscale image is in fact a global descriptor. Doing this for the RGB images, will get you a color histogram, which is also a global descriptor. However, these global descriptors can be used as local features descriptors also.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-15 04:08:48 -0500 )edit

Hehe, you are right :) ! I haven't thought about such 'simple' descriptors.

Guanta gravatar imageGuanta ( 2013-03-15 06:29:13 -0500 )edit

Probably since researchers gave up using these techniques like 20 years ago ... global features are only helpfull to further improve local feature detections in select regions.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-15 06:42:40 -0500 )edit

@Guanta: Thank you for your answer. Actually the BoW approach using local features was my first thought but I haven't found examples on how to use BoW with multiple kind of features. I'm sorry to ask but could you provide minimal sample code?

Shin gravatar imageShin ( 2013-03-15 07:10:35 -0500 )edit

There exist already an example: samples/cpp/bagofwords_classification.cpp . Hope that helps you.

Guanta gravatar imageGuanta ( 2013-03-15 11:24:03 -0500 )edit

@Guanta: thank you. I have seen that example, but i am interested in mixing different kinds of features, combining descriptors from, say, sift AND surf, in single vectors and then getting bow descriptors. Is this approach feasible or i'm saying something wrong ?

Shin gravatar imageShin ( 2013-03-15 11:50:18 -0500 )edit

It perfectly possible.

  • Take a feature point.
  • Then apply SIFT descriptor.
  • Store it in a vector.
  • Apply SURF descriptor.
  • Store it behind the SIFT part in the vector.
  • Use the vector for BoW approach.

However, this seams overkill and will slow down the process drastically. Especially since you will need much more storage space for your description vectors.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-15 14:35:14 -0500 )edit

There exist three other ways to use multiple features in BoW: You can omit the merging of the features but build multiple codebooks for both features and then either compute one descriptor by e.g. a weighted k-means or compute multiple independent histograms (=bow-descriptor) and merge them. Or third: Use the multiple histograms for independent classification and merge the classification results. For Stevens and my first approach the following paper may be interesting for you:

Guanta gravatar imageGuanta ( 2013-03-16 08:09:36 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-03-14 14:14:29 -0500

Seen: 3,551 times

Last updated: Mar 15 '13