% cements 2 or more frames together, given the PAIRWISE cross chirp between them % % parameters are vectors, pairwise % % Examples: mosaic=cement2(v0,p1,v1); % where p takes v2 to v1 % mosaic=cement2(v0,p1,v1,p2,v2,v3,p3); % % Bugs: now only up to 10 frames (quick hack) % you probably want to use cement.m which reads files and uses CUMULATIVE p % % See also: cement_cumulative (uses cumulative parameters) % % You probably want to use cement_cumulative, and not this, because % cement_cumulative allows for specification of ref. frame or ref. coord. function empty=limitednumberofinputs(p00,v00,p01,v01,p02,v02,p03,v03,p04,v04,p05,v05,p06,v06,p07,v07,p08,v08,p09,v09,p10,v10) if (nargin/2) ~= round (nargin/2) error('cement.m: need even number of input args; 1 parameter for each image') end%if LENGTH_p=(nargin/2); % p00 included in this list now (change from before) p=NaN*ones(LENGTH_p,8); for length_p=0:LENGTH_p-1 if max(size(eval(sprintf('p%02d',length_p))))~=8 disp(sprintf('cement2: input parameter %d must be of length 8',length_p)) end%if if min(size(eval(sprintf('p%02d',length_p))))~=1 disp(sprintf('cement2: input parameter %d must be a vector',length_p)) end%if p(length_p+1,:)=eval(sprintf('p%02d',length_p)); end%for % now all are in vector p P=pintegrate(p); % if first element is identity, that is just integrated in %[Ml,Nl,Mh,Nh]=boundingboxextrema([[1 0 0 0 1 0 0 0];P]); % assume v0, the identity, is included % identity must be included in the boundingbox so frame 0 is within [Ml,Nl,Mh,Nh]=boundingboxextrema([P]); % now P includes reference parameter % which may or may not be the identity [M00,N00]=size(v00); Ml00=0; Nl00=0; Mh00=(M00-1)/M00; Nh00=(N00-1)/N00; % frame 0 on [0,1) M=M00; N=N00; % reference image size canvassize=[M*(Mh-Ml), N*(Nh-Nl)]; canvassize=2*ceil(canvassize/2); % getting even with mpeg empty=NaN*ones(ceil(canvassize)); %Mpixell00=round(M*Ml00+1 - M*Ml); %Mpixelh00=round(M*Ml00+M00 - M*Ml); %Npixell00=round(N*Nl00+1 - N*Nl); %Npixelh00=round(N*Nl00+N00 - N*Nl); %empty(Mpixell00:Mpixelh00, Npixell00:Npixelh00)=v00; %clear v00 % insert v00 if LENGTH_p >=00+1; [v00d,Ml00,Nl00]=pchirp2nocrop(P(00+1,:),v00); clear v00 [M00,N00]=size(v00d); Mh00=Ml00+(M00-1)/M00; Nh00=Nl00+(N00-1)/N00; Mpixell00=round(M*Ml00+1 - M*Ml); Mpixelh00=round(M*Ml00+M00 - M*Ml); Npixell00=round(N*Nl00+1 - N*Nl); Npixelh00=round(N*Nl00+N00 - N*Nl); empty(Mpixell00:Mpixelh00, Npixell00:Npixelh00)=maxnan(... empty(Mpixell00:Mpixelh00, Npixell00:Npixelh00),v00d); clear v00d end%if % insert v01 if LENGTH_p >=01+1 [v01d,Ml01,Nl01]=pchirp2nocrop(P(01+1,:),v01); % with P00, counts 0..N-1 clear v01 [M01,N01]=size(v01d); Mh01=Ml01+(M01-1)/M01; Nh01=Nl01+(N01-1)/N01; Mpixell01=round(M*Ml01+1 - M*Ml); Mpixelh01=round(M*Ml01+M01 - M*Ml); Npixell01=round(N*Nl01+1 - N*Nl); Npixelh01=round(N*Nl01+N01 - N*Nl); empty(Mpixell01:Mpixelh01, Npixell01:Npixelh01)=maxnan(... empty(Mpixell01:Mpixelh01, Npixell01:Npixelh01),v01d); clear v01d end%if % insert v02 if LENGTH_p >=02+1 [v02d,Ml02,Nl02]=pchirp2nocrop(P(02+1,:),v02); clear v02 [M02,N02]=size(v02d); Mh02=Ml02+(M02-1)/M02; Nh02=Nl02+(N02-1)/N02; Mpixell02=round(M*Ml02+1 - M*Ml); Mpixelh02=round(M*Ml02+M02 - M*Ml); Npixell02=round(N*Nl02+1 - N*Nl); Npixelh02=round(N*Nl02+N02 - N*Nl); empty(Mpixell02:Mpixelh02, Npixell02:Npixelh02)=maxnan(... empty(Mpixell02:Mpixelh02, Npixell02:Npixelh02),v02d); clear v02d end%of % insert v03 if LENGTH_p >=03+1 [v03d,Ml03,Nl03]=pchirp2nocrop(P(03+1,:),v03); clear v03 [M03,N03]=size(v03d); Mh03=Ml03+(M03-1)/M03; Nh03=Nl03+(N03-1)/N03; Mpixell03=round(M*Ml03+1 - M*Ml); Mpixelh03=round(M*Ml03+M03 - M*Ml); Npixell03=round(N*Nl03+1 - N*Nl); Npixelh03=round(N*Nl03+N03 - N*Nl); empty(Mpixell03:Mpixelh03, Npixell03:Npixelh03)=maxnan(... empty(Mpixell03:Mpixelh03, Npixell03:Npixelh03),v03d); clear v03d end%if % insert v04 if LENGTH_p >=04+1 [v04d,Ml04,Nl04]=pchirp2nocrop(P(04+1,:),v04); clear v04 [M04,N04]=size(v04d); Mh04=Ml04+(M04-1)/M04; Nh04=Nl04+(N04-1)/N04; Mpixell04=round(M*Ml04+1 - M*Ml); Mpixelh04=round(M*Ml04+M04 - M*Ml); Npixell04=round(N*Nl04+1 - N*Nl); Npixelh04=round(N*Nl04+N04 - N*Nl); empty(Mpixell04:Mpixelh04, Npixell04:Npixelh04)=maxnan(... empty(Mpixell04:Mpixelh04, Npixell04:Npixelh04),v04d); clear v04d end%if % insert v05 if LENGTH_p >=05+1 [v05d,Ml05,Nl05]=pchirp2nocrop(P(05+1,:),v05); clear v05 [M05,N05]=size(v05d); Mh05=Ml05+(M05-1)/M05; Nh05=Nl05+(N05-1)/N05; Mpixell05=round(M*Ml05+1 - M*Ml); Mpixelh05=round(M*Ml05+M05 - M*Ml); Npixell05=round(N*Nl05+1 - N*Nl); Npixelh05=round(N*Nl05+N05 - N*Nl); empty(Mpixell05:Mpixelh05, Npixell05:Npixelh05)=maxnan(... empty(Mpixell05:Mpixelh05, Npixell05:Npixelh05),v05d); clear v05d end%if % insert v06 if LENGTH_p >=06+1 [v06d,Ml06,Nl06]=pchirp2nocrop(P(06+1,:),v06); clear v06 [M06,N06]=size(v06d); Mh06=Ml06+(M06-1)/M06; Nh06=Nl06+(N06-1)/N06; Mpixell06=round(M*Ml06+1 - M*Ml); Mpixelh06=round(M*Ml06+M06 - M*Ml); Npixell06=round(N*Nl06+1 - N*Nl); Npixelh06=round(N*Nl06+N06 - N*Nl); empty(Mpixell06:Mpixelh06, Npixell06:Npixelh06)=maxnan(... empty(Mpixell06:Mpixelh06, Npixell06:Npixelh06),v06d); clear v06d end%if % insert v07 if LENGTH_p >=07+1 [v07d,Ml07,Nl07]=pchirp2nocrop(P(07+1,:),v07); clear v07 [M07,N07]=size(v07d); Mh07=Ml07+(M07-1)/M07; Nh07=Nl07+(N07-1)/N07; Mpixell07=round(M*Ml07+1 - M*Ml); Mpixelh07=round(M*Ml07+M07 - M*Ml); Npixell07=round(N*Nl07+1 - N*Nl); Npixelh07=round(N*Nl07+N07 - N*Nl); empty(Mpixell07:Mpixelh07, Npixell07:Npixelh07)=maxnan(... empty(Mpixell07:Mpixelh07, Npixell07:Npixelh07),v07d); clear v07d end%if % insert v08 if LENGTH_p >=08+1 [v08d,Ml08,Nl08]=pchirp2nocrop(P(08+1,:),v08); clear v08 [M08,N08]=size(v08d); Mh08=Ml08+(M08-1)/M08; Nh08=Nl08+(N08-1)/N08; Mpixell08=round(M*Ml08+1 - M*Ml); Mpixelh08=round(M*Ml08+M08 - M*Ml); Npixell08=round(N*Nl08+1 - N*Nl); Npixelh08=round(N*Nl08+N08 - N*Nl); empty(Mpixell08:Mpixelh08, Npixell08:Npixelh08)=maxnan(... empty(Mpixell08:Mpixelh08, Npixell08:Npixelh08),v08d); clear v08d end%if % insert v09 if LENGTH_p >=09+1 [v09d,Ml09,Nl09]=pchirp2nocrop(P(09+1,:),v09); clear v09 [M09,N09]=size(v09d); Mh09=Ml09+(M09-1)/M09; Nh09=Nl09+(N09-1)/N09; Mpixell09=round(M*Ml09+1 - M*Ml); Mpixelh09=round(M*Ml09+M09 - M*Ml); Npixell09=round(N*Nl09+1 - N*Nl); Npixelh09=round(N*Nl09+N09 - N*Nl); empty(Mpixell09:Mpixelh09, Npixell09:Npixelh09)=maxnan(... empty(Mpixell09:Mpixelh09, Npixell09:Npixelh09),v09d); clear v09d end%if % insert v10 if LENGTH_p >=10+1 [v10d,Ml10,Nl10]=pchirp2nocrop(P(10+1,:),v10); clear v10 [M10,N10]=size(v10d); Mh10=Ml10+(M10-1)/M10; Nh10=Nl10+(N10-1)/N10; Mpixell10=round(M*Ml10+1 - M*Ml); Mpixelh10=round(M*Ml10+M10 - M*Ml); Npixell10=round(N*Nl10+1 - N*Nl); Npixelh10=round(N*Nl10+N10 - N*Nl); empty(Mpixell10:Mpixelh10, Npixell10:Npixelh10)=maxnan(... empty(Mpixell10:Mpixelh10, Npixell10:Npixelh10),v10d); clear v10d end%if