Generate canopy height raster image using cloudcompare command line

Feel free to ask any question here
Post Reply
hrshovon
Posts: 2
Joined: Sun Jun 21, 2020 2:10 pm

Generate canopy height raster image using cloudcompare command line

Post by hrshovon »

hello,
I am doing the following using GUI (Cloudcompare version 2.11)
1. I have a pointcloud data from which I have already separated the higher elevations(trees) and ground cloud points using CSF filter(python code).
2. Now I compute normal of the ground point cloud(QUADRIC model works best with mst knn 6). Then I create a ground mesh(DELAUNAY XY).
3. Then I calculate the cloud to mesh distance.
4. Finally, I rasterize the distance map(leaving missing values empty) and save the scalar fields. The resulting image is a single band geotiff image.

Now, I want to automate this process using command line(cloudcompare was installed via snap in ubuntu 18.04). But there are some issues.
1. For computing normal, I run the following command(Most of these commands were assumed from documentation, so they can be mistaken)

Code: Select all

snap run cloudcompare.CloudCompare -SILENT -o path/of/point/cloud -OCTREE_NORMALS auto -MODEL QUADRIC -ORIENT_NORMS_MST 6
2. That generates a file. Then I try to generate mesh.

Code: Select all

snap run cloudcompare.CloudCompare -SILENT -AUTO_SAVE OFF -o /path/to/generated/file/from/1 -DELAUNAY -AA -MAX_EDGE_LENGTH 0 -SAVE_MESHES FILE mesh_ground.bin
3. Then I tried to load the trees point cloud and the mesh_ground.bin in cloudcompare gui to see the output of the mesh. But whenever I load the mesh and tree point cloud(by dragging to the cloudcompare window), both disappears.
4. Still I generate the cloud to mesh distance file.

Code: Select all

snap run cloudcompare.CloudCompare -SILENT -o /path/to/trees/file -o mesh_ground.bin -c2m_dist
5. That generates a file which can be visualized in cloudcompare. But when rasterized using cloudcompare GUI, it has some strange gridlike lines, which do not appear when I do the entire process using GUI.
6. I tried to generate raster image using the following command,

Code: Select all

snap run cloudcompare.CloudCompare -SILENT -AUTO_SAVE OFF -o /pathg/to/cloud/to/mesh/distance/file -RASTERIZE -GRID_STEP 0.1 -PROJ MAX -SF_PROJ AVG -OUTPUT_RASTER_Z
But this file has 2 bands instead of 1 and the image is very blurry compared to when the entire process is done using GUI.
So can anyone help me with the commands?

Thanks in Advance.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Generate canopy height raster image using cloudcompare command line

Post by daniel »

This looks a lot like an issue with large coordinates. In command line mode, make sure to explicitly tell CloudCompare how to manage large coordinates (with the '-GLOBAL_SHIFT' suboption of the -O option).

And also, normals are not required to compute Delaunay mesh (you can skip this step I believe).
Daniel, CloudCompare admin
hrshovon
Posts: 2
Joined: Sun Jun 21, 2020 2:10 pm

Re: Generate canopy height raster image using cloudcompare command line

Post by hrshovon »

Thanks a lot for replying!
should I do so even in case of bin files?
Given this warning in the documentation?
warning: the GLOBAL_SHIFT option will be ignored for BIN files as they already contain their own GLOBAL_SHIFT values!
Note: file type is automatically guessed from its extension.
Most of the files being generated are in .bin format.
Also, I think computing normals using QUADRIC model is generating a better mesh for me. So I would like to do that.

UPDATE:
Thanks for the tip on GLOBAL_SHIFT. It worked quite well
Now I have a distance bin file which shows expected output.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Generate canopy height raster image using cloudcompare command line

Post by daniel »

If the files are already in BIN format, then the global shift shouldn't be necessary indeed?!

And the normals are only used for display if they are present before computing the mesh. Mind that the mesh geometry will be exactly the same (as normals are not used).
Daniel, CloudCompare admin
Post Reply