如何在Matlab中通过MSER和HOG进行匹配

我想知道在Matlab中是否有MSER和HOG完全实现图像匹配.目前我正在使用
VLFeat,但在执行图像匹配时遇到了困难.有帮助吗?

顺便说一下,我在VLFeat -Matlab环境中尝试了以下代码,但不幸的是无法进行匹配.

%Matlab code
%
pfx = fullfile(vl_root,'figures','demo') ;
randn('state',0) ;
rand('state',0) ;
figure(1) ; clf ;

Ia = imread(fullfile(vl_root,'data','roofs1.jpg')) ;
Ib = imread(fullfile(vl_root,'data','roofs2.jpg')) ;

Ia = uint8(rgb2gray(Ia)) ;
Ib = uint8(rgb2gray(Ib)) ;

[ra,fa] = vl_mser(I,'MinDiversity',0.7,'MaxVariation',0.2,'Delta',10) ;
[rb,fb] = vl_mser(I,'MinDiversity',0.7,'MaxVariation',0.2,'Delta',10) ;

[matches, scores] = vl_ubcmatch(fa, fb);

figure(1) ; clf ;
imagesc(cat(2, Ia, Ib));
axis image off ;
vl_demo_print('mser_match_1', 1);

figure(2) ; clf ;
imagesc(cat(2, Ia, Ib));

xa = ra(1, matches(1,:));
xb = rb(1, matches(2,:)) + size(Ia,2);
ya = ra(2, matches(1,:));
yb = rb(2,matches(2,:));

hold on ;
h = line([xa ; xb], [ya ; yb]);
set(h, 'linewidth', 1, 'color', 'b');

vl_plotframe(ra(:,matches(1,:)));
rb(1,:) = fb(1,:) + size(Ia,2);
vl_plotframe(rb(:,mathces(2,:)));
axis image off ;

vl_demo_print('mser_match_2', 1);

%%%%%%

最佳答案 有几个问题.首先,代码有几个错误,并且不按原样运行.我在下面贴了我的工作版.

更重要的是,您正在尝试使用SIFT特征匹配函数来匹配MSER椭球.这根本不起作用,因为SIFT基于局部图像梯度提供了非常高的维度特征向量,而MSER检测器只给你一个边界椭球.

VLFeat似乎不包含MSER匹配功能,因此您可能需要编写自己的功能.看一下原来的MSER论文,了解它们是如何匹配的:

“Robust wide-baseline stereo from maximally stable extremal regions”, Matas et al. 2002

% Read the input images
Ia = imread(fullfile(vl_root,'data','roofs1.jpg')) ;
Ib = imread(fullfile(vl_root,'data','roofs2.jpg')) ;

% Convert to grayscale
Ia = uint8(rgb2gray(Ia)) ;
Ib = uint8(rgb2gray(Ib)) ;

% Find MSERs
[ra,fa] = vl_mser(Ia, 'MinDiversity',0.7,'MaxVariation',0.2,'Delta',10) ;
[rb,fb] = vl_mser(Ib, 'MinDiversity',0.7,'MaxVariation',0.2,'Delta',10) ;

% Match MSERs
[matches, scores] = vl_ubcmatch(fa, fb);

% Display the original input images
figure(1); clf;
imagesc(cat(2, Ia, Ib));
axis image off;
colormap gray;

% Display a second copy with the matches overlaid
figure(2) ; clf ;
imagesc(cat(2, Ia, Ib));
axis image off;
colormap gray;

xa = fa(1, matches(1,:));
ya = fa(2, matches(1,:));
xb = fb(1, matches(2,:)) + size(Ia,2);
yb = fb(2, matches(2,:));

hold on ;
h = line([xa ; xb], [ya ; yb]);
set(h, 'linewidth', 1, 'color', 'y');
点赞