Pergunta

I want to know, if I can change the SIFT descriptors dimension , if so how can I do it. I know currently the dimension is 128, can we make is 128*4 or 124/4 something like this?

Update: I tried to change the SIFT_DESCR_WIDTH to 2, from 4 in opencv / modules / nonfree / src / sift.cpp , but it doesn't change the dimension of descriptors, when I print descriptors.size() it prints 128.

Regards,

Foi útil?

Solução

You cannot change SIFT dimensions in OpenCV without changing the OpenCV source. So you have to change sources and recompile whole OpenCV or nonfree module.

Change that constant value, then do cmake & make for OpenCV.

P.S. Actually, it wouldn`t change a lot for you - check original SIFT paper, figure 8.

Outras dicas

you can try SURF descriptors, it support 64 dimension, and compute quicker than SIFT.

You can use PCA (Principle Component Analysis) to try and go from 128 dimensions to 64 dimensions (or any dimensions you choose) after your descriptors have been extracted from your image. You're using C++, but I use Python for my OpenCV work and use sklearn.decomposition for this (I'm sure you can look up a similar library for C++). Basically it's similar to compression. Of course, you will lose some accuracy.

See https://en.wikipedia.org/wiki/Principal_component_analysis

Of course, any image you test against your data set will also need to have PCA run against it's descriptor vectors with the same dimension settings.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top