0001 function par = image_pair_noise_variances(Nig,Nih,Image_l,Image_r,X,par)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 DD = max([100,Nig]);
0023 [M,N] = size(Image_l);
0024 x_min = max([1,X(1,1)-DD]);
0025 y_min = max([1,X(1,2)-DD]);
0026 x_max = min([M,X(1,1)+DD]);
0027 y_max = min([N,X(1,2)+DD]);
0028 [s_g,m_g,~] = noise_standard_deviation_estimation(Image_l(x_min:x_max,y_min:y_max,:));
0029
0030 stg = mean(s_g)'*256;
0031
0032 display(['avg. noise std [gr] left : ', ...
0033 num2str(mean(stg))])
0034 par.vg = stg.^2;
0035
0036
0037
0038
0039
0040 DD = max([100,Nih]);
0041 [M,N] = size(Image_r);
0042 x_min = max([1,X(2,1)-DD]);
0043 y_min = max([1,X(2,2)-DD]);
0044 x_max = min([M,X(2,1)+DD]);
0045 y_max = min([N,X(2,2)+DD]);
0046
0047 [s_h,m_h,~] = noise_standard_deviation_estimation(Image_r(x_min:x_max,y_min:y_max,:));
0048
0049 sth = mean(s_h)'*255;
0050 display(['avg. noise std [gr] right : ', ...
0051 num2str(mean(sth))])
0052
0053 par.vh = sth.^2;
0054
0055
0056 D = [X(2,3)/X(1,3)*eye(2),[0;0];0 0 1];
0057 alpha = X(2,4)-X(1,4);
0058 R = [cos(alpha) -sin(alpha) 0;sin(alpha) cos(alpha) 0;0 0 1];
0059 par.A_true = D*R;
0060
0061 par.B_true = sqrtm(par.A_true);
0062 par.Bi_true = inv(par.B_true);
0063
0064
0065 par.A_a = par.A_true;
0066 par.Ai_a = inv(par.A_a);
0067
0068 display([ 'Scale difference : ',num2str(X(2,3)/X(1,3))])
0069 display([ 'Rotation difference : ',num2str(alpha*180/pi), '°'])
0070 display( 'Geometric affinity z = B y : ')
0071 display(A_a);
0072
0073
0074
0075
0076 Nih = round(factor_s*X(2,3));
0077
0078
0079 g = round(mean(Image_l(X(1,1)-Nig:X(1,1)+Nig,X(1,2)-Nig:X(1,2)+Nig,:),3));
0080 h = round(mean(Image_r(X(2,1)-Nih:X(2,1)+Nih,X(2,2)-Nih:X(2,2)+Nih,:),3));
0081
0082 if plot_type > 1
0083 figure(9)
0084 subplot(max_iter+1,4,1)
0085 imshow(g/255)
0086 title('left')
0087 subplot(max_iter+1,4,2)
0088 imshow(h/255)
0089 title('right')
0090 end
0091
0092
0093
0094 figure('name','noise standard deviations');
0095 hold on
0096 plot(mean(s_g)*255,'-b','LineWidth',2);
0097 plot(mean(s_h)*255,'-r','LineWidth',2);
0098 title('Noise standard deviations: left (blue), right(red)')
0099 xlim([min([m_g(:);m_h(:)]),max([m_g(:);m_h(:)])]*255)
0100 ylim([0,1.1*max([mean(s_g)'*255;mean(s_h)'*255])])
0101
0102 end
0103