%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 = loadframe(13); f2 = loadframe(19); 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 q=reshape(q,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);