Home > Matching_SYM_LSM > demo_LSM_small.m

demo_LSM_small

PURPOSE ^

% Sym-LSM small demo

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Sym-LSM small demo

 The demo routine demo_LSM_small.m shows the most simple
 form of using of the main routine, here LSM_62_sym_warp_main.m.
 The required input data are loaded from file. The routine assumes the
 approximate values for the geometric transformation is given.
 Furthermore, the noise variance functions vg and vh are assumed to be
 provided, e.g. determined from a representative image using the routine
 noise_standard_deviation_estimation.m. The input images, the noise 
 standard deviations and the change of the estimated image windows are
 shown in figures.

 wf 7/2020

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Sym-LSM small demo
0002 %
0003 % The demo routine demo_LSM_small.m shows the most simple
0004 % form of using of the main routine, here LSM_62_sym_warp_main.m.
0005 % The required input data are loaded from file. The routine assumes the
0006 % approximate values for the geometric transformation is given.
0007 % Furthermore, the noise variance functions vg and vh are assumed to be
0008 % provided, e.g. determined from a representative image using the routine
0009 % noise_standard_deviation_estimation.m. The input images, the noise
0010 % standard deviations and the change of the estimated image windows are
0011 % shown in figures.
0012 %
0013 % wf 7/2020
0014 
0015 
0016 close all
0017 clearvars
0018 %clc
0019 
0020 addpath(genpath('src/')) 
0021 
0022 disp(' --------------------------------------------------------------------- ')
0023 disp(' ---- Symmetric LSM with 6 geometric and 2 radiometric parameters ---- ')
0024 disp(' ----------------- two corresponding windows ------------------------- ')
0025 disp(' --- with given approximate values and noise characteristics --------- ')
0026 disp(' --------------------------------------------------------------------- ')
0027 %% set parameters
0028 plot_type       = 1;        % degree of output
0029 max_iter        = 7;        % maximum number of iterations
0030 sigma_smooth    = 0;        % smoothing of estimated function f
0031 Nf_MIN          = 4;        % minimum size of overlap
0032 
0033 %% provide input data
0034 % --- load data ---------------------------------------------------------
0035 load('example_data/Sym_LSM_small_demo');
0036 % g,h       two square images
0037 % vg,vh     two 256x1 vectors of noise variances (LUT)
0038 % A_a       3x3 matrix of approx. geometric transformation
0039 % R_a       1x2 vector of approx. parameters of radiometric transformation
0040 
0041 % --- show square images g and h ----------------------------------------
0042 g=double(g);
0043 h=double(h);
0044 figure('name','given image patches')
0045 hold on
0046 subplot(1,2,1)
0047 imshow(g/255);
0048 title('left image')
0049 subplot(1,2,2)
0050 imshow(h/255);
0051 title('right image')
0052 
0053 % --- give geometric affinity A_(3x3) : z = A y -------------------------
0054 disp( 'Approximate geometric transformation affinity  zh = Ah yh: ')
0055 disp(A_a);
0056 % --- give radiometric affinity R_(1x2): h = R1*y + R2 ------------------
0057 disp(['Approximate intensity transformation h = R1*y + R2 [gr]  : [',...
0058     num2str(R_a(1)),',',num2str(R_a(2)*255),']'])
0059 
0060 % ---  maximum number of iterations N_iter ------------------------------
0061 disp(['Maximum number of iterations                             : ', num2str(max_iter)])
0062 
0063 % ---  minimum size of overlap  ------------------------------
0064 disp(['Minimum size of overlap                                  : ', num2str(Nf_MIN),'x', num2str(Nf_MIN)])
0065 
0066 % ---  smoothing kernel sigma_smooth ------------------------------------
0067 disp(['Smoothing kernel [pixels]                                : 0'])
0068 
0069 % --- noise standard deviations vg and vh (256x1) -----------------------
0070 figure('name','noise standard deviations');
0071     hold on
0072     plot(sqrt(vg),'-b','LineWidth',2);
0073     plot(sqrt(vh),'-r','LineWidth',2);
0074     title('Noise standard deviations: left (blue), right(red)')
0075     xlim([0,255])
0076     ylim([0,1.1*max([sqrt(vg);sqrt(vh)])])
0077     
0078 %% === main routine Sym-LSM =============================================
0079 
0080 disp('=== Iteration sequence =======================================')
0081 
0082 [est_x,est_sigma_0,NN,Nf,Red,N_iter] = LSM_62_sym_warp_main...
0083     (g,h,vg,vh,A_a,R_a,sigma_smooth,max_iter,Nf_MIN,1);
0084 
0085 %% === show results =====================================================
0086 A_est   = [reshape(est_x.x(1:6),2,3);0 0 1];
0087     Rm_est  = [ est_x.x(7:8)';0 1];
0088     Ai_est  = A_est;
0089     
0090 image_pair_analyse(...
0091     A_a,  ...
0092     R_a, ...
0093     Ai_est, ...
0094     Red, ...
0095     est_sigma_0, ...
0096     est_x, ...
0097     1,0);
0098 
0099 disp(' --------------------------------- ')
0100 disp(' ----  end demo symmetric LSM ---- ')
0101 disp(' --------------------------------- ')
0102 
0103

Generated on Sun 19-Jul-2020 23:00:25 by m2html © 2005