• 大小: 3.29MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-12
  • 语言: Matlab
  • 标签: 图像拼接  

资源简介

用matlab仿真的基于灰度匹配算法的图像拼接,代码简单,适合初学者学习

资源截图

代码片段和文件信息

clear all;
clc;                         
J=imread(‘63.bmp‘);               
figure(1) imshow(J);
J1=rgb2gray(J);                     
figure(2) imshow(J1);               
fs=J1(20:1:end20:1:end);          
figure(3)imshow(fs);
whos fs;                               
imwrite(fs‘3.tif‘);                   
G=imread(‘64.bmp‘);                
figure(4)imshow(G)
G1=rgb2gray(G);                       
figure(5)imshow(G1);                  
fs=G1(20:1:end20:1:end);         
figure(6)imshow(fs);
whos fs;                               
imwrite(fs‘4.tif‘);                   
Y=imread(‘3.tif‘);          
[M N]=size(Y);                       
H=imread(‘4.tif‘);       
xiaotu=Y(end-80:endend-50:end);                   
figure(7);
imshow(xiaotu);
I=double(H);                        
X=double(xiaotu);
[M1 N1]=size(I);
[m1 n1]=size(X);
for i=1:M1-m1+1
    for j=1:N1-n1+1
        temp=I(i:i+m1-1j:j+n1-1);
        c(ij)=sum(sum(temp.*X));
        b(ij)=sqrt(sum(sum(temp.*temp)).*sum(sum(X.*X)));
        t(ij)= c(ij)/b(ij);
    end
end
MAX=max(max(t));
[hanglie]=find(t==MAX);
% hang
% lie
A=H(1:hang+m1-1lie:end);
figure(8);
imshow(A);
B=Y(1:end1:end-50);
figure(9);
imshow(B);
HE=cat(2BA);
figure(10);
imshow(HE);
whos fs;                               
imwrite(fs‘HE.tif‘);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件      502254  2013-03-14 16:53  63.bmp
     文件      901782  2013-03-14 16:53  64.bmp
     文件        1347  2013-03-14 20:03  pinjie1.m
     文件     2583562  2014-12-25 19:33  基于灰度匹配算法的简单拼接.docx

评论

共有 条评论