Gaussian kernel in OpenCV to generate multiple scales

asked 2017-03-01 04:14:59 -0500

lovaj gravatar image

I want to implement an OpenCV version of VL_PHOW() (matlab src code) from VLFeat. In few words, it's dense SIFT with multiple scales (increasing SIFT descriptor bin size) to make it scale invariant.

However, the authors suggests to apply a Gaussian kernel to improve the results. In paritcular, the Magnif parameter describe it:

Magnif 6 The image is smoothed by a Gaussian kernel of standard deviation SIZE / MAGNIF. Note that, in the standard SIFT descriptor, the magnification value is 3; here the default one is 6 as it seems to perform better in applications.

And this is the relevant matlab code:

% smooth the image to the appropriate scale based on the size
% of the SIFT bins
sigma = opts.sizes(si) / opts.magnif ;
ims = vl_imsmooth(im, sigma) ;

My question is: how can I implement this in OpenCV? The equivalent function in OpenCV seems to be GaussianBlur, but I can't figure out how to represent the code above in terms of this function.

edit retag flag offensive close merge delete

Comments

your link is about 3.0-beta you should update it to 3.2. Now if you scroll link page you will find getGaussianKernel with a link in last doc here. I think it is what you need. All docs are here

LBerger gravatar imageLBerger ( 2017-03-01 04:22:56 -0500 )edit

@LBerger thanks for your answer. However, I don't understand what the ksize parameter should be. Besides, is it correct that the matlab code above can be replicated using cv::GaussianBlur(in, out, cv::Size(), sigma) ?

lovaj gravatar imagelovaj ( 2017-03-01 04:40:21 -0500 )edit

ksize is filter size and it is not sigma Example kernel size can be 3x3 or 5x5 or 21x21 with sigma =1. It will change accuracy. Of course 21x21 is better than 3x3 but sometime 5x5 is enough. You will have to decide.

LBerger gravatar imageLBerger ( 2017-03-01 04:46:39 -0500 )edit