% octave function loadf.m % % loads response function from picture of test chart % % returns [black, 11 step greyvalues, white] %load in the function f(q) %from test pattern picture function [f, y]=loadf(k); if ((k<100) | (k>118)) error('must load one of frame 100 to 118') end%if %%%Y=loadtestpatterntop(k); Y=loadframe(k); Ytop = Y(395:575,494:1531); % top portion of test pattern Y=Y(395:907,494:1524); % take out only the test pattern portion y=mean(Ytop); %%plot(y) %find(absdiff=abs((diff(y)))>4) %and edit out repeats: stepposn=[1 93 188 284 379 472 568 662 756 850 944 1036]; for l=1:11 begin=stepposn(l); endin=stepposn(l+1); yportion=y(begin:endin); f(l)=median(yportion); end%for f=f(11:-1:1); % reverse samples %%blackregionL=Y(181:331,383:454); %%blackregionR=Y(181:331,587:659); blackregionL=Y(181+10:331-10,383:454); % to be sure top and bottom ok blackregionR=Y(181+10:331-10,587:659); b1=mean(blackregionL); % mean down cols b1=median(b1); % median across rows b2=mean(blackregionR); b2=median(b2); black=(b1+b2)/2; %%keyboard f=[black;f(:)]; % prepend black to this %whiteregion=Y(181+10:331-10,454+10:587-10); %w=mean(whiteregion); %w=median(w); %f=[f;w]; %white region appears to be same as lightest test bar q0=.011; % true black % true black then 11 values of steps: q=[.011; .021; .048; .079; .126; .185; .264; .358; .472; .622; .733; .893]; % now make a nice plot %x=linspace(0,11,length(y)); %grid %axis([0 12 0 256]); %xlabel('spatial coordinate, x') %ylabel('response function, y(x)=f(q(x))') %plot(x,y)