mos1.m
资源名称:ibrmasac.rar [点击查看]
上传用户:jiangyu148
上传日期:2014-10-19
资源大小:2124k
文件大小:2k
源码类别:
图形图象
开发平台:
Matlab
- function I=mos1(image1,image2)
- L = image1;
- R = image2;
- L1 = rgb2gray(L);
- R1 = rgb2gray(R);
- [h,w] = size(L1);
- L = double(L);
- R = double(R);
- [row,col] =phasec(L1,R1);
- LL = w-col+1;
- dd = 1/LL;
- if row < h/2
- new = zeros(h-row+1,w+col-1,3);
- new(:,1:col-1,1) = L(row:h,1:col-1,1) / 255;
- new(:,w+1:w+col-1,1) = R(1:h-row+1,w-col+2:w,1) / 255;
- for i = 1:h-row+1
- for j = 1:LL
- new(i,j+col-1,1) = (L(row+i-1,j+col-1, 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:col-1,2) = L(row:h,1:col-1,2)/255;
- new(:,w+1:w+col-1,2) = R(1:h-row+1, w-col+2:w, 2) / 255;
- for i=1:h-row+1
- for j = 1:LL
- new(i,j+col-1,2) = ( L(row+i-1,j+col-1, 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:col-1,3)=L(row:h,1:col-1,3) / 255;
- new(:,w+1:w+col-1,3)=R(1:h-row+1,w-col+2:w,3) / 255;
- for i=1:h-row+1
- for j = 1:LL
- new(i,j+col-1,3) = ( L(row+i-1,j+col-1, 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(row,2*w-(w-col+1),3);
- new(:,1:col-1,1)=L(1:row,1:col-1,1)/255;
- new(:,w+1:w+col-1,1)=R(h-row+1:h,w-col+2:w,1)/255;
- for i=1:row
- for j = 1:LL
- new(i,j+col-1,1)=( L(i,j+col-1,1) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(h-row+i,j,1) * (0.5* sin (pi*j * dd - pi/2) + 0.5)) / 255;
- end
- end
- new(:,1:col-1,2)=L(1:row,1:col-1,2)/255;
- new(:,w+1:w+col-1,2)=R(h-row+1:h,w-col+2:w,2)/255;
- for i=1:row
- for j = 1:LL
- new(i,j+col-1,2) = ( L(i,j+col-1,2) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(h-row+i,j,2) * (0.5* sin (pi*j * dd - pi/2) + 0.5)) / 255;
- end
- end
- new(:,1:col-1,3)=L(1:row,1:col-1,3)/255;
- new(:,w+1:w+col-1,3)=R(h-row+1:h,w-col+2:w,3)/255;
- for i=1:row
- for j = 1:LL
- new(i,j+col-1,3) = ( L(i,j+col-1,3) * (1 - (0.5* sin (pi*j * dd - pi/2) + 0.5)) ...
- + R(h-row+i,j,3) * (0.5* sin (pi*j * dd - pi/2) + 0.5)) / 255;
- end
- end
- end
- I=new;