📄 partshiftz0.m
字号:
function Y = partshiftZ0(D,len,wid)%D = partshiftZ0(D,len,wid)%Pads the matrix with zeros%Assumes D is 0-degree alignedif nargin < 3, wid = 0;end%if nargin > 3, %Circularly shift the array so that the u,v, aligns up %ie, if respIm(:,:,1,parent) has the canonical alignment, the most %likely kid orientation should be shifted to be respIm(:,:,1,kid)% [uu,vv] = pol2cart(([0:stepo:360+stepo]+90) * pi/180,1);% [dummy,I] = max(uu*u + vv*v);% D = circshift(D,[0 0 -(I-1)]);%end [imy, imx, imo] = size(D);stepo = 360/imo; %stepo = 15 degrees%[ux,vx] = pol2cart(([stepo:stepo:360]+180) * pi/180,wid); %Width offset%[uy,vy] = pol2cart(([stepo:stepo:360]+90) * pi/180,len); %Length offset[ux,vx] = pol2cart(([stepo:stepo:360]+180-stepo+180) * pi/180,wid); %Width offset[uy,vy] = pol2cart(([stepo:stepo:360]+90-stepo+180) * pi/180,len); %Length offsetvx = -vx;vy = -vy;xvec = round(ux+uy);yvec = round(vx+vy);maxv = round(max(abs([xvec yvec])));Y = zeros([imy imx imo]);;D = padarray(D,[maxv maxv 0],'both');for i = 1:imo, Y(:,:,i) = D(maxv+yvec(i)+1:imy+maxv+yvec(i),maxv+xvec(i)+1:imx+maxv+xvec(i),i);end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -