% converts the 10 qchirp2 parameters to the 8 pchirp parameters using the % 4 corners of a presumed image as the common points to define the relation % between the qchirp2 parameters and the pchirp2 parameters function p2=approximationatcorners(p1) if nargin==0 error('qchirp22p: you must have an input argument') end%if if length(p1) ~= 10 error('qchirp22p: input vector, must have length 10') end%if if min(size(p1)) ~= 1 error('qchirp22p: input must be a vector and not a matrix') end%if x1=0; y1=0; x2=0; y2=1; x3=1; y3=0; x4=1; y4=1; x=[x1;x2;x3;x4]; y=[y1;y2;y3;y4]; u=p1(1)*ones(4,1) + p1(2)*x + p1(3)*y +p1(4).*x.*x + p1(5).*x.*y; v=p1(6)*ones(4,1) + p1(7)*x + p1(8)*y +p1(9).*y.*y + p1(10).*x.*y; p2=corners2r([u(1) v(1) u(2) v(2) u(3) v(3) u(4) v(4)]); % now p2 would map the first image into the second but we wish to map % the second to the first %p2=reshape([p2(:);1],3,3).'; % .' because want across rows %p2=reshape(inv(p2),9,1).'; % .' because want across rows %p2=p2(1:8); p2=pinverse(p2); % same as 3 commented lines above, but neater