gist特征matlab,Gist描述子

gistdescriptor.zip

Computing the gist descriptor:

To compute the gist descriptor on an image use the function LMgist. The next example reads one image and computes the descriptor (the images demo1.jpg and demo2.jpg are available inside the gistdescriptor.zip file).

% Load image

img = imread('demo2.jpg');

% GIST Parameters:

clear param

param.orientationsPerScale = [8 8 8 8]; % number of orientations per scale (from HF to LF)

param.numberBlocks = 4;

param.fc_prefilt = 4;

% Computing gist:

[gist, param] = LMgist(img, '', param);

Visualization:

To visualize the gist descriptor use the function showGist.m. Here there is an example of how to use it:

% Visualization

figure

subplot(121)

imshow(img)

title('Input image')

subplot(122)

showGist(gist, param)

title('Descriptor')

Image similarities:

When computing image similarities, it might be important to normalize the image size before computing the GIST descriptor. This can be achieved by setting the image size inside the param struct (using the field param.imageSize). The LMgist function will resize and crop each image to match the specified size before computing the gist descriptor. The resizing operation will not affect the aspect ratio of the original image. The crop will be centered and the image will be resize so that the cropped region preserves as much as possible from the original input image. Here is an example:

% Load images

img1 = imread('demo1.jpg');

img2 = imread('demo2.jpg');

% GIST Parameters:

clear param

param.imageSize = [256 256]; % it works also with non-square images (use the most common aspect ratio in your set)

param.orientationsPerScale = [8 8 8 8]; % number of orientations per scale

param.numberBlocks = 4;

param.fc_prefilt = 4;

% Computing gist:

gist1 = LMgist(img1, '', param);

gist2 = LMgist(img2, '', param);

% Distance between the two images:

D = sum((gist1-gist2).^2)

Image collections:

The first call to LMgist will precompute the filters in the frequency domain and store them in param.G, subsequent calls will be faster.

% GIST Parameters:

clear param

param.imageSize = [256 256]; % set a normalized image size

param.orientationsPerScale = [8 8 8 8]; % number of orientations per scale (from HF to LF)

param.numberBlocks = 4;

param.fc_prefilt = 4;

% Pre-allocate gist:

Nfeatures = sum(param.orientationsPerScale)*param.numberBlocks^2;

gist = zeros([Nimages Nfeatures]); % Load first image and compute gist:

img = imread(file{1});

[gist(1, :), param] = LMgist(img, '', param); % first call

% Loop:

for i = 2:Nimages

img = imread(file{i});

gist(i, :) = LMgist(img, '', param); % the next calls will be faster

end

The script demoGist.m shows a few more examples and also how it works with non-square images. The function LMgist can also work the LabelMe toolbox.

http://people.csail.mit.edu/torralba/code/spatialenvelope/

project page:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值