% cropping is consistent with toshiba (elmo) w/ 7.5mm lens,
% recorded on world's smallest vcr

function [r,g,b] = myname(l)
% strange "more" bug observed; more turns self on in est of ttt_retreat sequence
%%more off

scale=1/2;
%scale=1;
disp('loadframe: downsampling by factor of 2');

eval(sprintf('!djpeg images/ttt_retreat_deinterlaced_dewarped%03d.jpg > deleteme_deleteme.ppm',l))
[r g b]=loadpnm('deleteme_deleteme.ppm');

if nargout==1
  dis('loadframe.m: generating frame %d from rgb; double check .3,.5,.2',l)
  r=.3*r + .5*g + .2*b;
end%if

if scale==0.5
  r=undsamavg(r);
  if nargout==3
    g=undsamavg(g);
    b=undsamavg(b);
  end%if
end%if
if scale==0.25
  r=undsamavg(undsamavg(r));
  if nargout==3
    g=undsamavg(undsamavg(g));
    b=undsamavg(undsamavg(b));
  end%if
end%if

if (scale~=1)&(scale~=.5)&(scale~=.25)
  error('loadframe: scale must be 1, 1/2, or 1/4 for now')
end%if
  
if nargout==2
  error('loadframe: 2 output arguments not supported')
end%if

% disp('loadframe; setting more off: not sure why comes on...')
%%% more off

