Tree segmentation workflow

Tree segmentation workflow

First generate a filelist from the working folder directory

dir /b /s *.las>filelist.txt

Next, generate bare earth layers from the classified points (bare earth = class 2):

for /F "eol=; tokens=1* delims=,. " %%i in (D:\plot_trees_CA\Points\filelist.txt) do call create_bare_surface %%i

A second batch file called create_bare_surface:

GridSurfaceCreate /class:2 /median:3 /smooth:3 D:\plot_trees_CA\DTM\%~n1.dtm 1 m m 1 11 2 2 %1.las

Next, generate the canopy height models and .ASC format files

Batch file:

for /F "eol=; tokens=1* delims=,. " %%i in (D:\plot_trees_CA\Points\filelist.txt) do call create_chm %%i

Call file:

CanopyModel /ground:D:\plot_trees_CA\DTM\%~n1.dtm /outlier:-1,80 D:\plot_trees_CA\CHM\%~n1.dtm 0.333 m m 1 11 2 2 %1.las
DTM2ASCII D:\plot_trees_CA\CHM\%~n1.dtm

 

In Matlab I run the VLM on each tile:

 

tile=asc_import('D:\plot_trees_CA\CHM\D01_2012.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\D01_2012.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\D01_2012.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\D01_2012.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\D02_2012.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\D02_2012.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\D02_2012.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\D02_2012.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\D03_2010.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\D03_2010.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\D03_2010.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\D03_2010.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\D04_2012.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\D04_2012.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\D04_2012.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\D04_2012.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\D05_2010.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\D05_2010.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\D05_2010.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\D05_2010.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y01_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y01_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y01_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y01_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y02_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y02_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y02_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y02_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y03_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y03_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y03_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y03_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y04_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y04_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y04_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y04_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y05_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y05_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y05_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y05_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y06_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y06_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y06_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y06_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y07_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y07_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y07_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y07_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y08_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y08_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y08_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y08_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y09_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y09_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y09_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y09_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y10_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y10_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y10_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y10_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y11_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y11_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y11_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y11_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y12_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y12_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y12_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y12_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y13_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y13_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y13_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y13_2013.xlsx',col_header,1,'A1');
tile=asc_import('D:\plot_trees_CA\CHM\Y14_2013.asc');
tile_v=vlm(tile,0.075,2);
tile_exp=export_utm(tile_v,tile);
dlmwrite('D:\plot_trees_CA\CHM\Y14_2013.csv',tile_exp,'delimiter',',','precision',10);
col_header={'ID','UTME','UTMN','HT','PRED','AREA','EQDIAM','MAJAX','MINAX','MAXHT','MINHT','MEANHT'};
xlswrite('D:\plot_trees_CA\CHM\Y14_2013.xlsx',tile_exp,1,'A2');
xlswrite('D:\plot_trees_CA\CHM\Y14_2013.xlsx',col_header,1,'A1');