4

MSER と HOG による画像マッチングの完全な実装が Matlab にあるかどうかを知りたかったのです。現在、私は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);

%%%%%%
4

2 に答える 2

1

方法はわかりませんが、MSER マッチングは Matlab 自体で機能します。

以下のコード

file1 = 'roofs1.jpg';
file2 = 'roofs2.jpg';

I1 = imread(file1);
I2 = imread(file2);

I1 = rgb2gray(I1);
I2 = rgb2gray(I2);

% %Find the SURF features.
% points1 = detectSURFFeatures(I1);
% points2 = detectSURFFeatures(I2); 

points1 = detectMSERFeatures(I1);
points2 = detectMSERFeatures(I2); 

%Extract the features.
[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);

%Retrieve the locations of matched points. The SURF featurevectors are already normalized.
indexPairs = matchFeatures(f1, f2, 'Prenormalized', true) ;
matched_pts1 = vpts1(indexPairs(:, 1));
matched_pts2 = vpts2(indexPairs(:, 2));


figure; showMatchedFeatures(I1,I2,matched_pts1,matched_pts2,'montage');
legend('matched points 1','matched points 2');

次の図を与える

ここに画像の説明を入力

于 2013-07-29T16:48:03.157 に答える
1

いくつかの問題があります。まず、コードにいくつかのエラーがあり、そのままでは実行されません。作業中のバージョンを以下に貼り付けました。

さらに重要なことは、SIFT 機能照合関数を使用して MSER 楕円体を照合しようとしていることです。SIFT は局所的な画像勾配に基づいて非常に高次元の特徴ベクトルを提供し、MSER 検出器は境界楕円体を提供するだけなので、これはまったく機能しません。

VLFeat には MSER マッチング関数が含まれていないようです。そのため、おそらく独自の関数を作成する必要があります。元の MSER 論文を見て、彼らがどのようにマッチングを行ったかを理解してください。

「最大限に安定した極限領域からのロバストなワイドベースライン ステレオ」、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');
于 2013-02-08T04:30:07.127 に答える