Rasterize point cloud by point class (each class custom RGB value)

446 views
Skip to first unread message

Lui

unread,
Aug 9, 2016, 10:41:49 PM8/9/16
to LAStools - efficient tools for LiDAR processing
Hi!

I would really like to do rasterization (kind of coverage) of several point classes with LAStools. The problem is that I have to produce a raster where each class (usually 2 or 3 with small overall cover) should be rasterized with a custom RGB color (needed due to visualization demands). It will be enough if it is done class by class (running operation as many time as there are classes that should be rasterized). Is it possible to do it in LAStools? I tried with las2dem and lasgrid but I didn't find a way.

Many thanks

Lui

Martin Isenburg

unread,
Aug 9, 2016, 11:28:13 PM8/9/16
to LAStools - efficient command line tools for LIDAR processing
Hello,

easy peasy with lasgrid and '-set_RGB' if you can do it in seperate passes as follows:


Here using the venerable 'fusa.laz' that is distributed with LAStools. The resulting three images are attached. If you want to "smoothen" out the transitions you can add the command line option '-subcircle 0.2' which will widen the points into a disk with radius 0.2 during gridding:

D:\LAStools\bin>lasgrid -i ..\data\fusa.laz ^
                                      -keep_class 6 ^
                                      -set_RGB 255 0 0 ^
                                      -rgb -step 2 ^
                                      -o fusa_buildings_red.png

D:\LAStools\bin>lasgrid -i ..\data\fusa.laz ^
                                      -keep_class 5 ^
                                      -set_RGB 0 255 0 ^
                                      -rgb -step 2 ^
                                      -o fusa_veggies_green.png

D:\LAStools\bin>lasgrid -i ..\data\fusa.laz ^
                                      -keep_class 2 ^
                                      -set_RGB 0 0 255 ^
                                      -rgb -step 2 ^
                                      -o fusa_ground_blue.png

Cheers,

Martin @rapidlasso

fusa_buildings_red.png
fusa_veggies_green.png
fusa_ground_blue.png

Petra Steffen

unread,
Sep 12, 2016, 6:49:54 AM9/12/16
to LAStools - efficient tools for LiDAR processing
Hello,

I have a very similar question, so I'm just going to post in this thread.
I want a graphic output of the classification and I want to set the color for each class so that the colors are more intuitive than a false color image (see attachement). Basically I want to color ground points brown, vegetation green, buildings orange and unclassified points black (or somewhat like that). Unlike Lui I would like to have one output containing all classes if that is possible (as I have already one giant heap of tiles which does not need further multiplying).
I know that for this task I can generally use lasgrid with the -classification option, but how do I change the coloring of the classes according to my idea?

In the README of lasgrid I only find the lines
-scale_rgb_up  and -scale_rgb_down

So I don't really have a clue if what I want to do is possible and how it might be done.
Basically just assigning different colors to each class I have within one run, that's what I need.

Can anyone help?

I appreciate it!

Petra
tile_200m_class_false.png

Martin Isenburg

unread,
Sep 25, 2016, 9:42:46 AM9/25/16
to LAStools - efficient command line tools for LIDAR processing
Hello Petra,

indeed. That was an excellent suggestion. The current "false color" output of lasgrid for the option '-classification' (which uses per step by step size pixel cell the classification code that appears the most frequent as the output value for that pixel) was really not very useful. 


I have changed that so in the next version of LAStools you will get the attached output image as a result for this command line on the venerable 'fusa.laz' file.

lasgrid -i ..\data\fusa.laz -classification -false -o fusa.png

Regards,

Martin

--
fusa.png

Karol K.

unread,
Feb 2, 2021, 8:36:13 AM2/2/21
to LAStools - efficient tools for LiDAR processing
Martin,

Expanding on this old topic and your solution for individual class custom RGB (which in case of many classes means a lot of time and extra process to 'merge' them) assigned to set classes.

Do you think it would be a possible new feature to set RGB per class in a command line with lasgrid doing a single process? 
Also otherwise I found it possible to apply a pallete to a raster ( when using -classification_variety) which then would set something like:
0 255 255 255
1 128 128 128
2 165 42 42
3 0 128 0
...
and the raster with pixel value of class numer, would then be interpreted in a GIS software a 1-channel with RGB pallete of set colours. 
So perhaps an option to -set_RGB_pallete from a .txt file in the palette format I shown above, could solve it??

Thanks,
Karol

Martin Isenburg

unread,
Jun 10, 2021, 6:21:56 PM6/10/21
to LAStools - efficient command line tools for LIDAR processing
Hello Karol,

just for smaller values (currently from 0 to 63) I have added this support.


The file 'color_map' is a simple text file with a straight forward map that looks like this 

0 255 255 255
1 128 128 128
2 255 0 0
6 165 42 42
5 0 0 255
42 0 0 128
63 0 125 255 
   
These two examples are identical except for the output coloring, they map the classification code that contributes the highest number of points per area to a false color or the mapped color. 

lasgrid -i ..\data\fusa.laz -classification_majority -o fusa_class.png -false
lasgrid -i ..\data\fusa.laz -classification_majority -o fusa_class_mapped.png -color_map map.txt  

Also these two examples are identical except for the output coloring, they map the number of different classification codes that contribute per area to a false color or the mapped color. 

lasgrid -i ..\data\fusa.laz -classification_variety -o fusa_class_var.png -false
lasgrid -i ..\data\fusa.laz -classification_variety -o fusa_class_var_mapped.png -color_map map.txt  

Regards,

Martin

---
You received this message because you are subscribed to the Google Groups "LAStools - efficient tools for LiDAR processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lastools+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lastools/909b7cdf-232e-4454-bc18-f93bb30060d5n%40googlegroups.com.
fusa_class.png
fusa_class_mapped.png
fusa_class_var.png
fusa_class_var_mapped.png

Guilherme Sanchez

unread,
Jan 25, 2022, 2:28:33 AM1/25/22
to last...@googlegroups.com
Hello Jochen,

Is it possible to extend this new functionality to other maps?
I think it would be useful on all types of maps, but especially for number_returns, scan_angle, scan_angle_abs, user_data, point_source, attribute 0, 1, 2 and return_type.

Another important improvement would be to increase the number of values within the txt file to 256 lines.

Regards,
Guilherme Sanchez

Message has been deleted

Support at rapidlasso

unread,
Jan 25, 2022, 2:32:42 AM1/25/22
to LAStools - efficient tools for LiDAR processing
Hi Guilherme,
this should be possible. Thanks for the request - I put it on my todo list...
Regards,
Jochen
Reply all
Reply to author
Forward
0 new messages