vl_dsift trying to get a feature vector at every pixel

坚强是说给别人听的谎言 提交于 2019-12-09 03:27:30

问题


I am trying to use vl_dsift to get the 128*1 feature vectors at every pixel. Therefore I want the resulting matrix to have size

128*(#OfPixels)

However when I use it on an image of size (192*168) then the resulting descriptor gives size (128*31,185) with a binsize of 1 and a magnification factor of 1.

I = imread('Faces\yaleB11_P00A-130E+20.pgm');
size(I)

figure
imshow(I)

binSize = 1 ;
magnif = 1 ;
Is = vl_imsmooth(single(I), sqrt((binSize/magnif)^2 - .25)) ;
[f, d] = vl_dsift(single(I), 'size', binSize) ;

size(f)
size(d)

回答1:


I am afraid you cannot extract the feature vectors for all the pixels in the image.

As you can see from figure 'Dense SIFT descriptor geometry' in the following link ( http://www.vlfeat.org/api/dsift.html ) dense sift extracts the features from 4-by-4 window. Since this box cannot move outside the image, top left bin of the 4-by-4 window can be at first pixel namely (1,1). Thus in this situation ( assuming your bin size is 1), the center of the 4-by-4 window is at (2.5, 2.5) in other words between 2nd and 3rd pixels in both x and y direction. Please notice that in this situation the 4-by-4 window is covering 16 pixels which are [1,4] x [1,4] pixels.

Now say your image of the size n-by-m. In the same manner when the bottom right bin of 4-by-4 window is at last pixel (pixel at n,m) the center of the 4-by-4 window will be at [n-1.5, m-1.5]. In your case your features will start from pixel at 2.5 x 2.5 and will end at 190.5 x 166.5

So the bottom line is that the center of 4-by-4 window travels in X direction from 'XMIN + 3/2 * SIZE' to 'MAX - 3/2 * SIZE' with steps of size 'STEP'. Where XMIN and XMAX are the first and the last pixels in X direction respectively. Same for Y axis(See the bottom paragraph 'FURTHER DETAILS ON THE GEOMETRY' at the link http://www.vlfeat.org/matlab/vl_dsift.html). As a result the 4-by-4 window travels whole the image.



来源:https://stackoverflow.com/questions/33289003/vl-dsift-trying-to-get-a-feature-vector-at-every-pixel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!