|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
function imagesmosaicdemo()
close all;
unregistered = imread('2.jpg');
baseimage=imread('1.jpg');
figure,imshow(baseimage);
figure,imshow(unregistered);
load cornerpairs.mat;
t_concord = cp2tform(corners2,corners1,'projective');
info = imfinfo('1.jpg');
registered = imtransform(unregistered,t_concord,'XData',[1 info.Width], 'YData',[1 info.Height]);
figure,imshow(registered);
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
这个程序是做2幅图片的图像拼接的,但只能出2幅原图象。运行是提示:
>> Warning: Image is too big to fit on screen; displaying at 56% scale.
> In D:\MATLAB6.5\toolbox\images\images\truesize.m (Resize1) at line 302
In D:\MATLAB6.5\toolbox\images\images\truesize.m at line 40
In D:\MATLAB6.5\toolbox\images\images\imshow.m at line 168
In D:\MATLAB6.5\work\imagesmosaicdemo.m at line 5
??? Error using ==> load
Unable to read MAT file D:\MATLAB6.5\work\cornerpairs.mat
File may be corrupt.
Error in ==> D:\MATLAB6.5\work\imagesmosaicdemo.m
On line 7 ==> load cornerpairs.mat; |
|