imagesmosaicdemo.m
来自「一个用MATLAB实现边缘检测的小程序!」· M 代码 · 共 36 行
M
36 行
%-------------------------------------------------------------------------
% 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 + =
减小字号Ctrl + -
显示快捷键?