修改matlab中的cvexShowMatches函数,使匹配结果更清楚

   

matlab 2011b中的函数cvexShowMatches()显示匹配图像是非常不爽。

执行如下代码:

I1 = imread('cameraman.tif');
I2 = imresize(imrotate(I1,-20), 1.2);
 
points1 = detectSURFFeatures(I1,'MetricThreshold',10000);
points2 = detectSURFFeatures(I2,'MetricThreshold',10000);
 
[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);
        
index_pairs = matchFeatures(f1, f2) ;
matched_pts1 = vpts1(index_pairs(:, 1));
matched_pts2 = vpts2(index_pairs(:, 2));

% Note that there are still several outliers present in the data, but
% otherwise you can clearly see the effects of rotation and scaling on
% the display of matched features.
  cvexShowMatches(I1,I2,matched_pts1,matched_pts2); % show matching points

   

显示的图像如下:

   

 这非常不方便,看起来一点都不清楚。

于是自己修改了cvexShowMatches() 这个函数,这样,就可以显示下面的图像了。是不是比较方便了?

修改好的函数在最后。请下载。

   

   

cvexShowMatches2()下载:http://dl.dropbox.com/u/48006175/cvexShowMatches2.m

posted @ 2011-12-08 13:07  随梦而飞  阅读(1798)  评论(0编辑  收藏  举报