% test version of cement.m (c) Steve Mann; developed over time period 1989-1994 % % cements 2 or more frames together, given the CUMULATIVE cross chirp between % % parameters are vectors, cumulatively expressed already % % Examples of use: first use P=pintegrate(p,3); % make cumulative, select lref % : C=cementtest(P,l1,l2); % calls loadframe.m to get ea. frame % : C=cementtest(P,l1,l2,skip_increment); % : example: C=cementtest(P,1,100,10); % uses every 10th frame % : C=cementtest(P,1,100,10,50); % highlights v50 w/ black border % : C=cementtest(P,1,100,10,0,3); % pads to size would be 0 to 3 % % e.g makes canvas as big as P0-P3 % % See also: cement_cumulative % (takes list of variables rather than calling loadframe) % % calls ``loadframe.m'' and ``pchirp2nocrop.m'', ``lightdarkgamma'' function empty=myname(P,l1,l2,skip_increment,borderedframe,porksizeframe_l2) more off % make sure doesn't stop if screen full of text... %%lightdarks5070=logspace(log(4) lightdarks=NaN*ones(1,236+1); lightdarks(50:120)=logspace(log10(4),log10(1/4),71); % for frame 50 to 120 if nargin==6 l1_pork=borderedframe; % not really borderedframe: actually padding l2_pork=porksizeframe_l2; if l1_pork > l2_pork error('cement: parameters 5 and 6 give extra "pork" support in wrong order') end%if if l1_pork > min(l1,l2) error('cement: first parameter''s ``pork'''' cannot be negative') end%if if l2_pork < max(l1,l2) error('cement: second parameter''s ``pork'''' cannot be negative') end%if end%if if nargin==3 disp('cement: skip_increment defaulting to 1; we''ll use every frame in interval') skip_increment=1; end%if if nargin==4 dis('cement: running from frame %d, to frame %d, in increments of %d',... l1,l2,skip_increment) end%if if max(max(size(l1))) > 1 error('cement: starting frame number (l1) must be a scalar') end%if if max(max(size(l2))) > 1 error('cement: ending frame number (l2) must be a scalar') end%if if isstr(l1) error('cement: starting frame (l1) must be a NUMBER, not a string') end%if if isstr(l2) error('cement: ending frame (l2) must be a NUMBER, not a string') end%if [M_P, N_P]=size(P); if N_P ~= 8 error('cement: input parameters must be in matrix with rows of width 8') end%if if isstr(P) error('cement: input parameters must be numbers not a string') end%if if ~isreal(P) error('cement: input parameters must be real') end%if if nargin < 6 % no "pork" (e.g. tight boundingbox) [Ml,Nl,Mh,Nh]=boundingboxextrema([P(l1+1:skip_increment:l2+1,:)]); % v03 to v15 uses P(4:16,:) % note P includes reference parameter which may or may not be the identity end%if if nargin==6 % pork (e.g. loose boundingbox for illustrative or experimental) [Ml,Nl,Mh,Nh]=boundingboxextrema([P(l1_pork+1:abs(skip_increment):l2_pork+1,:)]); end%if for l=l1:skip_increment:l2 dis('doing frame %d <= ***** %d ***** <= %d (increment=%d) of %d frames total',l1,l,l2,skip_increment,l2-l1+1) eval(sprintf('v%02d=loadframe(%02d);',l,l)) % v00, v01, ... v99, v100, ... if (nargin==5) if l==borderedframe dis('cement: highlighting frame %02d with black border',l) eval(sprintf('v%02d=borderblack(v%02d,5,2);',l,l)) end%if end%if if l==l1 % find size from first frame, hope that all frames same size [M, N]=size(eval(sprintf('v%02d',l1))); % base on size of one of frames which should be equal so base on frame l1 canvassize=[M*(Mh-Ml), N*(Nh-Nl)]; canvassize=2*ceil(canvassize/2); % getting even with mpeg disp(sprintf('cement_cumulative: about to nalloc %d by %d canvas (approx %7.3g Meg)',canvassize, 8*prod(canvassize)/(1024.^2))) empty=NaN*ones(ceil(canvassize)); else%if % each time, check that other frames are same size as first [Mnow, Nnow]=size(eval(sprintf('v%02d',l))); if Mnow~=M error(sprintf('cement: frame %d different height than first frame',l)) end%if if Nnow~=N error(sprintf('cement: frame %d different width than first frame',l)) end%if end%if l==0 % now insert frame l: eval(sprintf('[v%02dd,Ml%02d,Nl%02d]=pchirp2nocrop(P(%02d+1,:),v%02d,1,-1,NaN);',... l,l,l,l,l)) % note P(4,:) pertains to v03, etc. %above: [v50d,Ml50,Nl50]=pchirp2nocrop(P(50+1,:),v50,1,-1,NaN); eval(sprintf('[w%02dd,Ml%02d,Nl%02d]=pchirp2nocrop(P(%02d+1,:),lightdarkgamma(v%02d,lightdarks(%02d+1)),1,-1,NaN);',... l,l,l,l,l,l)) % note P(4,:) pertains to v03, etc. %above: [w50d,Ml50,Nl50]=pchirp2nocrop(P(50+1,:),lightdarkgamma(v50,lightdarks(50+1)),1,-1,NaN); eval(sprintf('c%02dd=certainty(v%02dd);',l,l)) eval(sprintf('clear v%02d',l)) eval(sprintf('[M%02d,N%02d]=size(v%02dd);',l,l,l)) % size after dechirp eval(sprintf('Mh%02d=Ml%02d+(M%02d-1)/M%02d; Nh%02d=Nl%02d+(N%02d-1)/N%02d;',l,l,l,l,l,l,l,l)) eval(sprintf('Mpixell%02d=round(M*Ml%02d+1 - M*Ml);',l,l)) eval(sprintf('Mpixelh%02d=round(M*Ml%02d+M%02d - M*Ml);',l,l,l)) eval(sprintf('Npixell%02d=round(N*Nl%02d+1 - N*Nl);',l,l)) eval(sprintf('Npixelh%02d=round(N*Nl%02d+N%02d - N*Nl);',l,l,l)) % UNCOMMENT ONE OF THESE (max, mean, new, newbroken): %eval(sprintf('empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)=maxnan(empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d),v%02dd);',l,l,l,l,l,l,l,l,l)) %eval(sprintf('empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)=meannan(empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d),v%02dd);',l,l,l,l,l,l,l,l,l)) % meancertain seems to give parts of the image looking negated for image sequence that doesn't have agc or such changes... %eval(sprintf('empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)=meancertainnan(empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d),v%02dd);',l,l,l,l,l,l,l,l,l)) eval(sprintf('top%02d=meannan(certainty(empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)).*empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d),c%02dd.*w%02dd);',l,l,l,l,l,l,l,l,l,l,l)) eval(sprintf('bot%02d=meannan(certainty(empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)),c%02dd);',l,l,l,l,l,l)) %keyboard eval(sprintf('empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)=top%02d./bot%02d;',l,l,l,l,l,l)) %eval(sprintf('empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)=newnan(empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d),v%02dd);',l,l,l,l,l,l,l,l,l)) %eval(sprintf('empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)=feathernewnan(empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d),v%02dd,21);',l,l,l,l,l,l,l,l,l)) % last arg of feathernewnan is feather radius %eval(sprintf('empty(Mpixell%02d:Mpixelh%02d, Npixell%02d:Npixelh%02d)=v%02dd;',l,l,l,l,l)) eval(sprintf('clear v%02dd',l)) eval(sprintf('clear w%02dd',l)) eval(sprintf('clear c%02dd',l)) eval(sprintf('clear top%02d',l)) eval(sprintf('clear bot%02d',l)) end%for %% what used to be there before eval(sprintf(' %% % 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%if %% % insert v03 %% ...