This tutorial illustrates how to perform point cloud classification in Agisoft Metashape Professional in manual and automatic modes and how to produce Digital Terrain Model (DTM). Metashape allows not only to generate and visualize point clouds but also to classify the points within them.
There are 3 options:
- automatic ground points classification (classifies point cloud based on the user-defined parameters);
- automatic multi-class point classification (automatically classifies point cloud to the supported classes);
- classify point cloud manually.
Point cloud classification opens the way to customize Build Mesh and Build DEM steps: you can choose what type of objects within the scene you would like to be reconstructed and indicate the corresponding point class as a source data for mesh generation. For example, if you build mesh or DEM based on ground points only, it will be possible to export DTM (as opposed to DSM).
This article describes the following processing steps:
- Automatic classify ground points
- Automatic point cloud multi-class classification
- Classify point cloud manually
- Filtering points based on points colors
- Build DEM
- Export DEM
If you need guidance on how to build a point cloud with Metashape Pro refer to Orthophoto & DEM Generation and follow all steps up to Build Point Cloud.
Metashape Standard version supports: Select Points by Masks, Select Points by Color, Filter by Confidence, Filter by Selection.
Automatic classify ground points
1. Select Tools > Point Cloud > Classify Ground Points... command.
2. The following parameters control automatic ground points classification procedure:
For aerial laser scan data, the ability to use return value during classification process is available. There is also a possibility keep existing ground points during classification process.
- Max angle (deg) - Determines one of the conditions to be checked while testing a point as a ground one, i.e. sets limitation for an angle between terrain model and the line to connect the point in question with a point from a ground class. In fact, this parameter determines the assumption for the maximum slope of the ground within the scene.
- Max distance (m) - Determines one of the conditions to be checked while testing a point as a ground one, i.e. sets limitation for a distance between the point in question and terrain model. In fact, this parameter determines the assumption for the maximum variation of the ground elevation at a time.
- Cell size (m) - Determines the size of the cells for point cloud to be divided into as a preparatory step in ground points classification procedure. Cell size should be indicated with respect to the size of the largest area within the scene that does not contain any ground points, e. g. building or close forest.
Erosion radius (m) - determines the indentation (in meters) from unclassified points to create an additional area from the object, it is useful when classifying houses and trees to exclude the remaining "stumps" when building DTM.
Return number - determines which return layer to use during classification (Any Return, First Return or Last Return) for aerial LiDAR data. Usually for laser scans, the first returned is the most significant return and will be associated with the highest feature in the landscape (trees, buildings and so on). It is possible to specify to use First return or Last return. Use the Any Return parameter to perform classification at all return levels.
3. Click OK button to run the classification procedure. Generally automatic classification procedure consists of two steps.
- At the first step the point cloud is divided into cells of a certain size. In each cell the lowest point is detected. Triangulation of these points gives the first approximation of the terrain model.
- At the second step new point is added to the ground class, providing that it satisfies two conditions: it lays within a certain distance from the terrain model and that the angle between terrain model and the line to connect this new point with a point from a ground class is less than a certain angle. The second step is repeated while there still are points to be checked.
4. Switch to the Point Cloud to Point Cloud Classes view mode using the corresponding buttons located on the Toolbar.
5. In case the result of automatic point cloud classification is not acceptable the procedure can be re-run using adjusted parameters (for example, if some on-ground objects like stones and small bushes were classified as ground points it is reasonable to reduce Max angle and Max distance parameter values).
It is important to reset the assigned classes for the point cloud prior to starting the procedure again with the new set of parameters. To reset classification results choose Reset Classification option in Tools > Point Cloud menu and then select point classes you wish to be discarded.
Automatic point cloud multi-class classification
Metashape allows for semantic classification of point clouds to solve the task of higher-level interpretation of the reconstructed data.
1. Select Classify Points... command from the Point Cloud submenu of the Tools menu (Tools > Point Cloud > Classify Points).
2. In the Classify Points dialog box select the source point class for the classification procedure in the From field.
3. Select the target classes from the list in "To" field.
4. Define Confidence parameter in 0 - 1 range. Higher value of the parameter means that the point which class cannot be reliably assigned, will remain unclassified.
5. Click OK button to run the classification procedure.
6. Switch to Point Cloud Classes view mode using Point Cloud toolbar button. The result of the filtering will be shown in the Model view.
Please note, that as a result of automatic classification, only 6 classes can be determined (Ground, High Vegetation, Building, Road Surface, Car, Man-made Object). The other classes can be set manually (this workflow is described in the Classify point cloud manually section). Below is a list of all classes and corresponding colors available in Metashape, including those that you can set manually.
Classify point cloud manually
1. Switch to the Point Cloud or Point Cloud Classes view mode using the corresponding buttons located on the Toolbar.
2. Select points in the Model view to be placed to a certain class using Rectangle Selection, Circle Selection or Free-Form Selection tools.
3. To add new points to the current selection hold the Ctrl key during the selection of additional points. To remove some points from the current selection hold the Shift key during the selection of points to be removed.
3. When all the points to be assigned to any class are in selection, choose Tools > Point cloud > Assign Class... .
4. In the Assign Class dialog specify source and destination class points. If you need to reset the classification results for selected points, choose Any Class in From field and Created (never classified) in To field.
5. The result of the filtering will be shown in the Model view.
Filtering points based on points colors
To remove points based on point colors.
1. Switch to Point Cloud view mode using Point Cloud toolbar button.
2. Choose Select Points by Color... command from the Point Cloud submenu of the Tools menu (Tools > Point Cloud > Select Points by Color).
3. In the Select Points by Color dialog box choose color to be used as the filter.
4. Click OK button to run the selection procedure.
5. The result of the filtering will be shown in the Model view.
6. Select Reset filter command from the Point Cloud submenu of the Tools menu to cancel filtering by colors.
New when the point cloud has been generated it is possible to generate polygonal mesh model based on the certain point classes. To produce Digital Terrain Model (DTM) on ground point class should be used for mesh reconstruction.
1. Select Build DEM command from the Workflow menu.
2. Set the following recommended values for the parameters in the Build DEM dialog.
Click Select button and uncheck all classes except class and click OK button to start building geometry.
3. Here are results of DEM generation based on class:
After the polygonal model reconstruction to export DEM use the standard export instruments.
1. Select Export DEM > Export GeoTIFF/BIL/XYZ command from File menu.
2. Set the following recommended values for the parameters in the Export DEM dialog.
3. Click Export... button and then specify target file name and select type of the exported file (e.g. GeoTIFF).
4. Click Save button to start DEM export.