Home > 16-Surfacereconstruction > fig_16_20_demo_surface_reconstruction.m

fig_16_20_demo_surface_reconstruction

PURPOSE ^

% Fig. 16.20 page 761

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Fig. 16.20 page 761
 Surface reconstruction: test dem smoothing, plots of sparse matrices A, N etc.

 Wolfgang Förstner 07/14
 last changes: Susanne Wenzel 09/16
 wfoerstn@uni-bonn.de, wenzel@igg.uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Fig. 16.20 page 761
0002 % Surface reconstruction: test dem smoothing, plots of sparse matrices A, N etc.
0003 %
0004 % Wolfgang Förstner 07/14
0005 % last changes: Susanne Wenzel 09/16
0006 % wfoerstn@uni-bonn.de, wenzel@igg.uni-bonn.de
0007 
0008 addpath(genpath('../General_Functions/'));
0009 addpath('Functions')
0010 
0011 close all
0012 
0013 %% set parameters
0014 
0015 % params for generating the data
0016 init_rand = 6;            % seed for random generator - may be changed for other example
0017 
0018 % smoothing
0019 type_robust = 0;
0020 %             0 not robust
0021 %             1 only dem
0022 %             2 only points
0023 %             3 both
0024 out_C = 1;    % 0 no covariance matrix as output
0025               % 1 covariance matrix as output
0026 
0027 % output settings
0028 type_data = 0;            % @todo: what is it good for
0029 print_type = 0;
0030 plot_type  = 0;
0031 
0032 %% initialize random number generation by fixed seed
0033 init_rand_seed(init_rand);
0034 
0035 
0036 %% ---------------------- LETS GO -----------------------------------------
0037 
0038 display('----- Fig. 16.20: Demo surface interpolation -----')
0039 
0040 %% generate dem point cloud
0041 [points,BB,delta_x,sigma_k,sigma_h,dem] = simulate_points_dem_0;
0042 
0043 %% interpolate
0044 
0045 out_in=zeros(size(points,1),1);
0046 
0047 [ds,S,Sigma,Np,Nr,Mc,ver,A,w,w_f,W] = smooth_dem_robust_bilinear...
0048     (points,BB,delta_x,sigma_k,out_C,type_robust,type_data,out_in,...
0049     print_type,plot_type);
0050 
0051 
0052 %% plot
0053 
0054 % plot settings
0055 ss = plot_init;
0056 
0057 % plot surface and points
0058 figure('name','Fig 16.20 Demo surface interpolation','color','w',...
0059     'Position',[0.1*ss(1),0.2*ss(2),0.8*ss(1),0.5*ss(2)]);
0060 
0061 subplot(1,2,1);hold on
0062 plot_surface(ds,BB,delta_x,'alpha',0.3,'view',[-29,65],'colormap','cool');
0063 for n=1:Np
0064     plot3(points(n,1),points(n,2),points(n,3),'.k','MarkerSize',15)
0065 end
0066 axis equal
0067 xlabel('x');ylabel('y');zlabel('z');
0068 title('Fitted surface','FontSize',16)
0069 
0070 % plot standarddeviation
0071 subplot(1,2,2);hold on
0072 plot_surface(sqrt(S),BB,delta_x,'alpha',0.3,'view',[-29,65],'colormap','cool');
0073 z=zeros(Np,1);
0074 for n=1:Np
0075     z(n)=interpolate_bilinear(S,points(n,1),points(n,2),delta_x,BB,sigma_h);
0076     plot3(points(n,1),points(n,2),sqrt(z(n)),'.k','MarkerSize',15) 
0077 end
0078 plot3(0,0,0,'.k')
0079 axis equal
0080 xlabel('x');ylabel('y');zlabel('\sigma_z');
0081 title('Standard deviations \sigma_z of the estimated grid points','FontSize',16)
0082 
0083 
0084

Generated on Sat 01-Oct-2016 21:05:04 by m2html © 2005