dir='/users/kakani/desktop/';
infocus='C0001_gray_focus.tif';
outfocus='C0001_gray_outfocus.tif';

in=imread([dir,infocus]);
out=imread([dir,outfocus]);

inval=in(290,:);
outval=out(290,:);
xval=1:size(inval,2);
figure(1)
plot(xval,inval,xval,outval)
legend('in focus', 'out of focus')
figure(2)
subplot(2,1,1)
imshow(in)
hold on
plot([1,960],[290,290],'w')
title('in focus')
hold off
subplot(2,1,2)
imshow(out)
hold on
plot([1,960],[290,290],'r')
title('out of focus')
hold off