📄 imagesmosaicdemo.m
字号:
%-------------------------------------------------------------------------
% image mosaicing demo program
% intro: this is a very simple demo program to join two images together
% corners are pre-matched to be saved into cornerpairs.mat
% developed by bugzhao for evaluation use only, April 2005 bugzhao@sohu.com
%-------------------------------------------------------------------------
function imagesmosaicdemo()
% read base image and the second image to be registered to the base image
close all;
unregistered = imread('q15.bmp');
baseimage=imread('b15.bmp');
figure,imshow(baseimage);
figure,imshow(unregistered);
% manually select point matches or automatically done by harris corner detector and CC matching
%load cornerpairs.mat;
round1=[44 50;58 63];
round2=[45 51;59 64];
t_concord = cp2tform(round1,round2,'linear conformal');
info = imfinfo('b15.bmp');
registered = imtransform(unregistered,t_concord,'XData',[1 info.Width], 'YData',[1 info.Height]);
figure,imshow(registered);
% do blending work using simplest pixel average
M=baseimage;
for row=1:info.Height
for col=1:info.Width
if(registered(row,col,1)~=0 && col<640)
M(row,col,:)=(double(registered(row,col,:))+double(baseimage(row,col,:)))/2;
end
if(registered(row,col,1)~=0 && col>640)
M(row,col,:)=double(registered(row,col,:));
end
end
end
figure,imshow(M);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -