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

function [r,g,b] = myname(l)

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

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

% already cropped (thus no need to crop again)
%r=r(2+1:486-8,7+1:646-7);
%g=g(2+1:486-8,7+1:646-7);
%b=b(2+1:486-8,7+1:646-7);

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

