Page 145 - Computational Colour Science Using MATLAB
P. 145

132                CHARACTERIZATION OF CAMERAS

                 else
                   plotgraphs = strcmp(’on’,graphs);
                 end


                 % fit the low-order polynomials
                 [pr1,sr1]=polyfit(r,ref,3);
                 [pg1,sg1]=polyfit(g,ref,3);
                 [pb1,sb1]=polyfit(b,ref,3);

                 % plot graphs if the plotgraphs variable is set
                 if (plotgraphs)
                   figure

                   subplot(3,2,1)
                   plot(r,ref,’ko’);
                   [pr1,sr1]=polyfit(r,ref,3);
                   x = linspace(0,1,11);
                   y = polyval(pr1,x);
                   hold on
                   plot(x,y,’k-’);
                   ylabel(’Y’)
                   xlabel(’R channel’);
                   axis([0 1 0 1])
                   subplot(3,2,2)
                   py = polyval(pr1,r);
                   plot(ref,py,’ko’);
                   hold on
                   plot([0 1], [0 1], ’k-’);
                   axis([0 1 0 1])
                   disp(255*py’)


                   subplot(3,2,3)
                   plot(g,ref,’ko’);
                   x = linspace(0,1,11);
                   y = polyval(pg1,x);
                   hold on
                   plot(x,y,’k-’);
                   ylabel(’Y’)
                   xlabel(’G channel’);
                   axis([0 1 0 1])
                   subplot(3,2,4)
                   py = polyval(pg1,g);
   140   141   142   143   144   145   146   147   148   149   150