%load Finv.txt
%load c.txt

Finv=makelut;  % genetrate LUT from known a,c, and s values
c=convert_Finv_to_c(Finv); % differentiate and interp to get certainty function

f1=loadpnm('/mann/a/a/htdocs/mannfamily_dark.pgm');
f2=loadpnm('/mann/a/a/htdocs/mannfamily_light.pgm');
[M,N]=size(f1);
q1=exp(Finv(f1+1))/0.25;
q2=exp(Finv(f2+1))/1;
% in Matlab q will be same size as f_i, but in Octave need to reshape
q1=reshape(q1,M,N);
q2=reshape(q2,M,N);
C1=c(f1+1); % certainty image from first image
C2=c(f2+1); % certainty image from second image
% in Matlab C will be same size as f_i, but in Octave need to reshape
C1=reshape(C1,M,N);
C2=reshape(C2,M,N);
q=(q1.*C1+q2.*C2)./(C1+C2);

