Home > Matching_SYM_LSM > src > 2D_LSM_62 > 2D_LSM_62_sym_Functions > LSM_62_sym_generate_true_observing_images.m

LSM_62_sym_generate_true_observing_images

PURPOSE ^

% LSM_62_sym_generate_true_observing_images

SYNOPSIS ^

function [f_true,g_true,h_true,par] =LSM_62_sym_generate_true_observing_images(I_true,par)

DESCRIPTION ^

% LSM_62_sym_generate_true_observing_images

 generating true images for symmetric LSM
 call
 [f_true,g_true,h_true] = LSM_62_sym_generate_true_observing_images...
     (Ni,I_true,par,plot_type)

 I_true            true image
 plot_type         in [0,1,2] controlling output

 f_true            true reference image
 g_true,h_true     true observing images
 std_g, std_h      standard deviations of bi-cubic interpolation error

 wf 7/2020

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% LSM_62_sym_generate_true_observing_images
0002 %
0003 % generating true images for symmetric LSM
0004 % call
0005 % [f_true,g_true,h_true] = LSM_62_sym_generate_true_observing_images...
0006 %     (Ni,I_true,par,plot_type)
0007 %
0008 % I_true            true image
0009 % plot_type         in [0,1,2] controlling output
0010 %
0011 % f_true            true reference image
0012 % g_true,h_true     true observing images
0013 % std_g, std_h      standard deviations of bi-cubic interpolation error
0014 %
0015 % wf 7/2020
0016 
0017 function [f_true,g_true,h_true,par] = ...
0018     LSM_62_sym_generate_true_observing_images(I_true,par)
0019 
0020 %% generate f_true, observing g, and h
0021 
0022 a7_true = par.S_true(1);
0023 a8_true = par.S_true(2);
0024 Bi_true = inv(par.B_true);
0025 % square f
0026 Nf    = par.Nfr+par.BOUND;
0027 bbf   = square_corners(Nf);
0028 
0029 Ni = (size(I_true,1)-1)/2;
0030 
0031 %% generate true image f including boundary
0032 Nf=par.Nfr+par.BOUND;
0033 f_true = zeros(2*Nf+1);
0034 for i=-Nf:Nf
0035     for j=-Nf:Nf
0036         x  = i+Ni+1;
0037         y  = j+Ni+1;
0038         % true signal basis: real valued
0039         f_true(i+Nf+1,j+Nf+1) = I_true(x,y);
0040     end
0041 end
0042 
0043 %% generate first image
0044 % size
0045 bbfg   = Bi_true*bbf;
0046 Ngr    = ceil(max(abs(bbfg(:))));
0047 Ng     = Ngr+par.BOUND;
0048 g_true = zeros(2*Ng+1);
0049 g      = zeros(2*Ng+1);
0050 % fill
0051 for i=-Ng:Ng
0052     for j=-Ng:Ng
0053         xh = par.B_true * [i;j;1];
0054         x  = xh(1)+Ni+1;
0055         y  = xh(2)+Ni+1;
0056         % true signal basis: real valued
0057         g_true(i+Ng+1,j+Ng+1) = ...
0058             (LSM_f_cubic_smoothing(x,y,I_true)-a8_true*255)/a7_true;
0059     end
0060 end
0061 
0062 %% generate second image
0063 % size
0064 bbfh  = par.B_true*bbf;
0065 Nhr   = ceil(max(abs(bbfh(:))));
0066 Nh    = Nhr+par.BOUND;
0067 h_true=zeros(2*Nh+1);
0068 h     =zeros(2*Nh+1);
0069 for i=-Nh:Nh
0070     for j=-Nh:Nh
0071         xh = Bi_true * [i;j;1];
0072         x  = xh(1)+Ni+1;    % coordinates referring to corner
0073         y  = xh(2)+Ni+1;
0074         % true signal basis: real valued
0075         h_true(i+Nh+1,j+Nh+1) = ...
0076             (a7_true*(LSM_f_cubic_smoothing(x,y,I_true))+a8_true*255);
0077     end
0078 end
0079 
0080 diff_g = conv2(g_true,par.Diff_filter,'valid');
0081 diff_h = conv2(h_true,par.Diff_filter,'valid');
0082 par.std_g  = std(diff_g(:));
0083 par.std_h  = std(diff_h(:));
0084 
0085 %% plots
0086 
0087 if par.plot_type > 0
0088     figure('Name','mean, left, right: generated true images')
0089     subplot(2,3,2);imshow(f_true/255);
0090     title(['f-true at [c,r] = [',num2str(par.col),',',num2str(par.row),'] (',...
0091         num2str(size(f_true,1)),'x',num2str(size(f_true,2)),')']);
0092     axis equal;
0093     subplot(2,3,4);imshow(g_true/255);
0094     title(['g-true (',num2str(size(g_true,1)),'x',num2str(size(g_true,2)),')']);axis equal;
0095     subplot(2,3,6);imshow(h_true/255);
0096     title(['h-true (',num2str(size(h_true,1)),'x',num2str(size(h_true,2)),')']);axis equal;
0097     colormap(gray)
0098     
0099 end
0100 end
0101

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