?? imaffill0.m
字號:
function PicA=imafFill(Pic,center,A,S,sizePicA,centerPicA,method) %function PicA=imafFill(Pic,center,A,S,sizePicA,centerPicA,method) % or %function PicA=imafFill(Pic,center,A,S,sizePicA,centerPicA) % or %function PicA=imafFill(Pic,center,A,S,sizePicA) %% Pic - image to be affinely transformed to get the result PicA.%% The affine transform of image 'Pic' is specified by % center - 2dim vector (column or string, not necessarily integer)% A - matrix [a b; c d] of the affine transform % S - [s1;s2] - shift vector-column of dimension size(S)=(2,1)%% The center of the resulting image 'PicA' is by default % its geometrical center, i.e. centerPicA=(sizePicA+[1,1])/2% % Under the affine transform % the point 'center' (in the 'Pic') goes to 'centerPicA+S' in the 'PicA',% % Pic(center+A*p+S)=PicA(centerPicA+p) where p is pixel coordinate-column;% (pixel coordinate [p(1);p(2)] is defined by Pic(p(1),p(2)),% so that the first axis is vertical!)% % method= 'linear' or 'nearest' or 'cubic'; default= 'linear' if omitted%% '..Fill' means that PicA is filled entirely by the information from the Pic% outside of 'Pic' there is asumed zero field.%% see also imaff.mif nargin<7 method='*linear';endif nargin<6 xc=(1+sizePicA(1))/2;yc=(1+sizePicA(2))/2; else xc=centerPicA(1); yc=centerPicA(2);endAi=inv(A); Si=-Ai*S;ai=Ai(1,1); bi=Ai(1,2);ci=Ai(2,1); di=Ai(2,2);s1i=Si(1,1); s2i=Si(2,1);[X,Y]=ndgrid(1:sizePicA(1),1:sizePicA(2));XA_=center(1)+ai*(X-xc)+bi*(Y-yc)+s1i;YA_=center(2)+ci*(X-xc)+di*(Y-yc)+s2i;PicA=interp2(Pic,YA_,XA_,method); PicA(isnan(PicA))=0; %this is commented in imafFill%figure; imagesc(PicA); axis equal; axis tight;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -