• 大小: 0.42M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-03-27
  • 语言: Matlab
  • 标签: matlab  

资源简介


有关数字图像处理中的模板匹配源代码

资源截图

代码片段和文件信息

%使用归一化相关函数进行配准
%Step 1: Read Images
lily = imread(‘lily.tif‘);
flowers = imread(‘flowers.tif‘);
figure imshow(lily)
figure imshow(flowers)   

%Step 2: Choose Subregions of Each Image 
% non-interactively
rect_lily = [93 13 81 69];
rect_flowers = [190 68 235 210];
sub_lily = imcrop(lilyrect_lily);
sub_flowers = imcrop(flowersrect_flowers);

% OR 
   
% interactively
% [sub_lilyrect_lily] = imcrop(lily); % choose one petal of lily
% [sub_flowersrect_flowers] = imcrop(flowers); % choose whole lily

% display sub images
figure imshow(sub_lily)
figure imshow(sub_flowers)   

%Step 3: Do Normalized Cross-correlation and Find Coordinates of Peak
c = normxcorr2(sub_lily(::1)sub_flowers(::1));
figure surf(c) shading flat

%Step 4: Find the Total Offset Between the Images
% offset found by correlation
[max_c imax] = max(abs(c(:)));
[ypeak xpeak] = ind2sub(size(c)imax(1));
% corr_offset = [(xpeak-size(sub_lily2)) 
%                (ypeak-size(s

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2556  2005-04-18 17:28  模板匹配\moban.m

     文件     129440  1999-10-30 19:51  模板匹配\lily.tif

     文件     543962  1996-10-25 22:11  模板匹配\flowers.tif

     目录          0  2008-05-31 09:06  模板匹配

----------- ---------  ---------- -----  ----

               675958                    4


评论

共有 条评论