mparkan / Digital-Forestry-Toolbox

A collection of digital forestry tools for Matlab/Octave
http://mparkan.github.io/Digital-Forestry-Toolbox/
GNU General Public License v3.0
46 stars 16 forks source link

dft_tutorial_2.m: Tutorial dataset works okay, but replacing it with my own produces: Unrecognized function or variable 'marker'. #12

Closed mavavilj closed 3 years ago

mavavilj commented 3 years ago

I'm able to run the dft_tutorial_2.m okay by using the example dataset (available at website). But when I replace the example dataset path with path to my own .las, then the height model looks a bit odd and also it runs into the following error:

detecting peaks...done!
filtering low peaks...done!
computing watershed transform...Unrecognized function or variable 'marker'.

Error in treeWatershed (line 141)
label(~ismember(label, label(marker))) = 0;

Error in dft_tutorial_2 (line 96)
[label_2d, colors] = treeWatershed(models.height.values, ...

How must my input .las be produced to work with the tutorial's code parts?

Hint:

I know that my point cloud contains "scan lines", i.e. small "no data" lines between lines of data. Maybe this causes the problem?

But I wonder how to get around it? I can e.g. produce a scan line filled chm elsewhere, but then I would need the Digital Forestry Toolbox code to work directly on a chm.png, rather than the equivalent .las? Is this possible?

Can I e.g. produce a refmat in order to not have to use elevationModels() at all? But use canopyPeaks() directly on a chm (GeoTiff) produced elsewhere?

mparkan commented 3 years ago

To identify the issue, I would need more information about the characteristics of your dataset (or a link to an example file if the data is public) and the parameters you are using in the functions.

"when I replace the example dataset path with path to my own .las, then the height model looks a bit odd"

It's possible that your dataset is not using the same point classification as in tutorial 2. If that's the case and you are still using the default parameters in the elevationModels function, than that could explain why your elevation model looks weird.

"How must my input .las be produced to work with the tutorial's code parts?"

There aren't any requirements on how the LAS file is produced, as long as it conforms to the LAS 1.0-1.4 format specification.

"I know that my point cloud contains "scan lines", i.e. small "no data" lines between lines of data. Maybe this causes the problem?"

This is a well known artifact with some types of LiDAR scanners and acquisition configurations. Depending on the separation distance between the scan lines, it could be an issue to properly model a canopy.

But I wonder how to get around it? I can e.g. produce a scan line filled chm elsewhere, but then I would need the Digital Forestry Toolbox code to work directly on a chm.png, rather than the equivalent .las? Is this possible? Can I e.g. produce a refmat in order to not have to use elevationModels() at all? But use canopyPeaks() directly on a chm (GeoTiff) produced elsewhere?

You might have to increase the pixel size of your raster model and/or use a different interpolation method to avoid having pits in your CHM. You can use any other GIS software to produce the height model, export it to a geotiff or ASC grid file, and import it to Matlab/Octave with geotiffread(Matlab only) or ASCread (Matlab/Octave).