mos2.m
资源名称:ibrmasac.rar [点击查看]
上传用户:jiangyu148
上传日期:2014-10-19
资源大小:2124k
文件大小:3k
源码类别:
图形图象
开发平台:
Matlab
- function I=mos2(image1,image2,row,col);
- L=double(image1);
- R=double(image2);
- h1=size(L,1);
- w1=size(L,2);
- h2=size(R,1);
- w2=size(R,2);
- col=w1-(610-col);%w_2 must have stable value, not alter as program goes
- LL=w1-col+1;
- TT=h1-row+1;
- dd=1/LL;
- if TT<h2
- new=zeros(h2+row-1,w1+w2-LL,3);
- %%%%%%%%%%%%
- new(1:h1,1:w1-LL,1)=L(1:h1,1:w1-LL,1)/255;
- new(1:row-1,col:w1,1)=L(1:row-1,col:w1,1)/255;
- new(row:h2+h1-TT,w1+1:w1+w2-LL,1)=R(1:h2,LL+1:w2,1)/255;
- new(h1+1:h1+h2-TT,col:w1,1)=R(TT+1:h2,1:LL,1)/255;
- for i=1:h1-row+1
- for j = 1:LL
- new(row+i-1,j+w1-LL,1) = (L(row+i-1,j+w1-LL, 1) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(i,j,1) * (0.5* sin (pi*j * dd - pi/2) + 0.5))/255;
- end
- end
- %%%%%%%%%%%%%
- new(1:h1,1:w1-LL,2)=L(1:h1,1:w1-LL,2)/255;
- new(1:row-1,col:w1,2)=L(1:row-1,col:w1,2)/255;
- new(row:h2+h1-TT,w1+1:w1+w2-LL,2)=R(1:h2,LL+1:w2,2)/255;
- new(h1+1:h1+h2-TT,col:w1,2)=R(TT+1:h2,1:LL,2)/255;
- for i=1:h1-row+1
- for j = 1:LL
- new(row+i-1,j+w1-LL,2) = (L(row+i-1,j+w1-LL, 2) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(i,j,2) * (0.5* sin (pi*j * dd - pi/2) + 0.5))/255;
- end
- end
- %%%%%%%%%%%%%
- new(1:h1,1:w1-LL,3)=L(1:h1,1:w1-LL,3)/255;
- new(1:row-1,col:w1,3)=L(1:row-1,col:w1,3)/255;
- new(row:h2+h1-TT,w1+1:w1+w2-LL,3)=R(1:h2,LL+1:w2,3)/255;
- new(h1+1:h1+h2-TT,col:w1,3)=R(TT+1:h2,1:LL,3)/255;
- for i=1:h1-row+1
- for j = 1:LL
- new(row+i-1,j+w1-LL,3) = (L(row+i-1,j+w1-LL, 3) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(i,j,3) * (0.5* sin (pi*j * dd - pi/2) + 0.5))/255;
- end
- end
- else
- new=zeros(h1,w1+w2-LL,3);
- %%
- new(1:h1,1:w1-LL,1)=L(1:h1,1:w1-LL,1)/255;
- new(1:row-1,col:w1,1)=L(1:row-1,col:w1,1)/255;
- new(row:h2+h1-TT,w1+1:w1+w2-LL,1)=R(1:h2,LL+1:w2,1)/255;
- new(h1+1:h1+h2-TT,col:w1,1)=R(TT+1:h2,1:LL,1)/255;
- for i=1:h2
- for j = 1:LL
- new(row+i-1,j+w1-LL,1) = (L(row+i-1,j+w1-LL, 1) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(i,j,1) * (0.5* sin (pi*j * dd - pi/2) + 0.5))/255;
- end
- end
- %%%%%%%%%%%%%
- new(1:h1,1:w1-LL,2)=L(1:h1,1:w1-LL,2)/255;
- new(1:row-1,col:w1,2)=L(1:row-1,col:w1,2)/255;
- new(row:h2+h1-TT,w1+1:w1+w2-LL,2)=R(1:h2,LL+1:w2,2)/255;
- new(h1+1:h1+h2-TT,col:w1,2)=R(TT+1:h2,1:LL,2)/255;
- for i=1:h2
- for j = 1:LL
- new(row+i-1,j+w1-LL,2) = (L(row+i-1,j+w1-LL, 2) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(i,j,2) * (0.5* sin (pi*j * dd - pi/2) + 0.5))/255;
- end
- end
- %%%%%%%%%%%%%
- new(1:h1,1:w1-LL,3)=L(1:h1,1:w1-LL,3)/255;
- new(1:row-1,col:w1,3)=L(1:row-1,col:w1,3)/255;
- new(row:h2+h1-TT,w1+1:w1+w2-LL,3)=R(1:h2,LL+1:w2,3)/255;
- new(h1+1:h1+h2-TT,col:w1,3)=R(TT+1:h2,1:LL,3)/255;
- for i=1:h2
- for j = 1:LL
- new(row+i-1,j+w1-LL,3) = (L(row+i-1,j+w1-LL, 3) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(i,j,3) * (0.5* sin (pi*j * dd - pi/2) + 0.5))/255;
- end
- end
- end
- I=new;