2012-12-05 4 views
4

Matlab에서 MSER 및 HOG에 의한 이미지 일치를 완전히 구현했는지 알고 싶습니다. 현재 VLFeat을 사용하고 있지만 이미지 일치를 수행 할 때 어려움을 발견했습니다. 어떤 도움이 필요합니까?Matlab에서 MSER 및 HOG로 일치를 수행하는 방법

Btw, 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); 

%%%%%% 
+0

당신이 정교한 수 있습니다? 너는 어떤 어려움을 겪었 는가? – carlosdc

+0

위의 코드를 시도했지만 불행히도 일치를 제대로 수행 할 수 없습니다. – fahmifahim

답변

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'); 
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'); 

아래의 코드는 다음 그림

enter image description here

+0

컴퓨터 비전 시스템 도구 상자가 필요합니다. – rayryeng

관련 문제