vl_dsift试图在每个像素获得一个特征向量 [英] vl_dsift trying to get a feature vector at every pixel
问题描述
我试图使用vl_dsift来获取每个像素的128 * 1个特征向量。因此,我希望生成的矩阵具有大小
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)
128*(#OfPixels)
在大小为(192 * 168)的图像上,则生成的描述符给出尺寸(128 * 31,185),二值化为1,放大系数为1.
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)
推荐答案
我恐怕你不能提取图像中所有像素的特征向量。
I am afraid you cannot extract the feature vectors for all the pixels in the image.
从下面的链接中可以看到Dense SIFT descriptor geometry( http://www.vlfeat.org/api/dsift.html )密集筛选从4×4窗口中提取特征。由于这个框不能移动到图像之外,所以4×4窗口的左上边框可以在第一像素即(1,1)。因此,在这种情况下(假定您的仓大小是1),4×4窗口的中心在x和y方向上在第二和第三像素之间的换句话说在(2.5,2.5)。请注意,在这种情况下,4×4窗口覆盖了[1,4]×[1,4]像素的16像素。
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.
图像大小n-by-m。
以相同的方式,当4×4窗口的右下方bin在最后一个像素(n,m处的像素)时,4×4窗口的中心将在[n-1.5,m -1.5]。在你的情况下,你的特征将从2.5×2.5像素开始,并将在190.5×166.5结束
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
所以底线是4×4窗口的中心沿X方向从' XMIN + 3/2 * SIZE'移动到'MAX-3/2 * SIZE',步长为'STEP'。其中X MIN和X MAX分别是X方向上的第一个和最后一个像素。 Y轴相同(请参阅链接 http://下面的底部一节关于几何的进一步详情 www.vlfeat.org/matlab/vl_dsift.html )。因此,4×4的窗口会移动整个图像。
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.
这篇关于vl_dsift试图在每个像素获得一个特征向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!