Skip to content

Tips and Tutorials \ Render a point cloud with Potree

Render a point cloud with Potree

This is a step by step tutorial to visualize a point cloud on Potree


Tools:
Difficulty:
Type: Tip
Categories: Visualization Tools


Overview

This tip shows how to render a point cloud with Potree, on TREX. In this example we generate the point cloud with CARS 0.4.2. image

Prerequisites

  • Basic knowledge on CARS usage

Generation of a point cloud with CARS

Step 1 - Run CARS (prepare + compute) on an image pair. Be careful to reserve a processing node with enough resources.

ml cars
cars prepare -i input.json -o out_prepare --nb_workers 15
cars compute_dsm -i out_prepare/content.json -o out_dsm --mode mp --nb_workers 15

He is the content of the file input.json:

{
    "img1" : "<path>/PAN_1.tif",
    "color1" : "<path>/MS_1.tif",
    "img2" : "<path>/PAN_2.tif",
    "srtm_dir" : "/datalake/static_aux/MNT/SRTM_30_hgt/",
    "nodata1": 0,
    "nodata2": 0
}

Step 2 - Get the code from the repository:

git clone git@gitlab.cnes.fr:cars/tools/cars-pctolas.git

Step 3 - Execute the following scripts to save the point cloud:

cd cars-pctolas
python cars-single-pc-from-outdir.py ../out_dsm
python cars-las-files-from-single-pc.py ../out_dsm/tmp/config_1/pc_ref.tif ../out_dsm/points.las

Visualization with Potree

Step 1 - First get the Potree project available in eolab :

cp -r /work/OT/eolab/tools/potree <my_directory>

Warning: if you don't have access to the folder, please contact dimitri.lallement@cnes.fr.

Step 2 - Potree initialization:

source /softs/projets/cars/thirdparty/init.sh

Step 3 - Point cloud ingestion (the point cloud will appear under the name <my_area> in Potree):

cd potree
PotreeConverter -i <path>/points.las -o points/<my_area>

Step 4 - Create a www link to PotreHelper. To do so, go to the root of your TREX user space (/home/il/<user>) then execute the following command line:

ln -s <my_directory>/potree www

Warning: If your Potree project is on /scratch it is advised to give the complete path. Example :

ln -s /work/scratch/lallemd/potree/ www

instead of:

ln -s /home/il/lallemd/scratch/potree/ www

Step 5 - Finally, you have to update the web page that lists the available point clouds with the following instruction (the script is available in the scripts folder in the potree folder that you get from step 1) :

./scripts/fill_index.sh

Now you can see the results on the following page (change user_TREX with your username): https://jupyterhub.cnes.fr/user/user_TREX/www/index.html

Updating the view with new point clouds

Each time you want to add a new point cloud, simply do:

source /softs/projets/cars/thirdparty/init.sh
PotreeConverter -i <path>/points.las -o points/<my_area>
./scripts/fill_index.sh

Complete example with the Gizeh pyramides

cd scratch
cp -r /work/OT/eolab/tools/potree potree
cd potree
ml cars/0.4.2
cars prepare -i /work/OT/eolab/DATA/PLEIADES/GIZEH/input13.json -o out_prepare --nb_workers 15
cars compute_dsm -i out_prepare/content.json -o out_dsm --mode mp --nb_workers 15
git clone git@gitlab.cnes.fr:cars/tools/cars-pctolas.git
python cars-pctolas/cars-single-pc-from-outdir.py ../out_dsm
python cars-pctolas/cars-las-files-from-single-pc.py ../out_dsm/tmp/config_1/pc_ref.tif ../out_dsm/points.las
ln -s /work/scratch/<user>/potree/ www
source /softs/projets/cars/thirdparty/init.sh
PotreeConverter -i out_dsm/points.las -o points/Pyramides
./scripts/fill_index.sh

Contacts

    Questions ? Get help on the Forum