Home > 16-Surface-Reconstruction > Surface-Reconstruction > fig_16_9b_demo_surface_reconstruction.m

fig_16_9b_demo_surface_reconstruction

PURPOSE ^

% Fig. 16.9 bottom page 740

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Fig. 16.9 bottom page 740
 Reconstruct dem from 7 points with flattening and smoothing

 Wolfgang Förstner 01/15
 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.9 bottom page 740
0002 % Reconstruct dem from 7 points with flattening and smoothing
0003 %
0004 % Wolfgang Förstner 01/15
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 % data generation
0016 init_rand = 6;             % init 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 = 0;    % 0 no covariance matrix as output
0025               % 1 covariance matrix as output
0026 
0027 % intermediate output
0028 print_type = 1;
0029 plot_type  = 0;
0030 
0031 
0032 %% plot settings
0033 ss = plot_init;
0034 
0035 %% initialize random number generation by fixed seed
0036 init_rand_seed(init_rand);
0037 
0038 
0039 %% ---------------------- LETS GO -----------------------------------------
0040 
0041 disp('----------------------------------------------------------------------------')
0042 disp('----- demo reconstruct dem from 7 points with flattening and smoothing -----')
0043 disp('----------------------------------------------------------------------------')
0044 
0045 % grid size
0046 dx=1/10;  % for final plot
0047 %dx=1/4;
0048 display(['Grid size = ',num2str(dx)])
0049 
0050 
0051 disp(' ')
0052 disp('... for final plot take grid size dx=1/10 (may take a minute)')
0053 disp(' ')
0054  
0055 
0056 %% generate dem point cloud
0057 [points,BB,delta_x,sigma_k,sigma_s,dem,out_in] = simulate_points_dem_0_flat(dx);
0058    
0059 
0060 %% interpolate flat
0061 starttime_flattening = cputime;
0062 ds_flat = smooth_dem_robust_bilinear_flat...
0063     (points,BB,delta_x,sigma_k,out_C,type_robust,...
0064     print_type,plot_type);
0065 
0066 disp(['      time for solution flattening: ',num2str(cputime-starttime_flattening)])
0067 
0068 %% interpolate smooth
0069 starttime_smoothing = cputime;
0070 ds_smooth = smooth_dem_robust_bilinear...
0071     (points,BB,delta_x,sigma_k,out_C,type_robust,...
0072     out_in,print_type,plot_type);    
0073     
0074 disp(['      time for solution smoothing: ',num2str(cputime-starttime_smoothing)])
0075 
0076 
0077 %% plot
0078 figure('name','Fig 16.9 bottom: Best fitting 2D function','color','w',...
0079     'Position',[0.1*ss(1),0.2*ss(2),0.8*ss(1),0.5*ss(2)]);
0080 
0081 subplot(1,2,1);hold on;
0082 plot_surface(ds_flat,BB,delta_x,'EdgeColor','none','FaceLighting','gouraud',...
0083         'ColorFct','smoothtanh','shading','interp','alpha',0.3,'view',[-20,30]);
0084 plot3(points(:,1),points(:,2),points(:,3),'.b','MarkerSize',15);
0085 axis equal
0086 title('flat dem with given points','FontSize',16)
0087 
0088 subplot(1,2,2);hold on
0089 plot_surface(ds_smooth,BB,delta_x,'EdgeColor','none','FaceLighting','gouraud',...
0090         'ColorFct','smoothtanh','shading','interp','alpha',0.3,'view',[-20,30]);   
0091 plot3(points(:,1),points(:,2),points(:,3),'.b','MarkerSize',15)
0092 axis equal
0093 title('smooth dem with given points','FontSize',16)
0094   
0095 
0096

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005