Hello,
following up on this discussion where Andrew asked for a better way to assign RGB values based on their classification
I would now like to show you how you can use LASlayers (starting with the newest version 161016) in combination with filters and transforms to achieve the same as before but with much less data stored to temporary files:
:: first we again create a file with colors
las2las -i ..\data\fusa.laz -set_point_type 3 -o fusaRGB.laz
:: then we make one filtered transform that colors the ground points
:: blue-ish but use laslayers with the new option '-add' to create a
:: new (tiny) LAY file instead of a new LAZ file
laslayers -i fusaRGB.laz ^
-add ^
-keep_class 2 ^
-filtered_transform ^
-set_RGB 50 255 255 ^
-olay
:: print the contents of the new LAY file
laslayers -i fusaRGB.laz
LASlayer 1 of 1
start_position 276
size 224
type 128 (transform)
fields 0 (all)
compression 1 (none)
modification_mask 7348224 (number_of_points_by_return max_x min_x max_y min_y max_z min_z)
ignore_mask 0
header_size 44
modification size 68
ignore size 0
description size 54
description -keep_class 2 -filtered_transform -set_RGB 50 255 255
:: look at the LAY file applied on the fly
lasview -i fusaRGB.laz -ilay
:: then we make one filtered transform that colors the building points
:: green-ish but use laslayers withoptions '-ilay' and '-add' to append
:: to the (tiny) LAY file instead of creating yet another LAZ file
laslayers -i fusaRGB.laz -ilay ^
-add ^
-keep_class 6 ^
-filtered_transform ^
-set_RGB 200 200 25 ^
-olay
:: print the contents of the modified LAY file
laslayers -i fusaRGB.laz
LASlayer 1 of 2
start_position 276
size 224
type 128 (transform)
fields 0 (all)
compression 1 (none)
modification_mask 7348224 (number_of_points_by_return max_x min_x max_y min_y max_z min_z)
ignore_mask 0
header_size 44
modification size 68
ignore size 0
description size 54
description -keep_class 2 -filtered_transform -set_RGB 50 255 255
LASlayer 2 of 2
start_position 500
size 224
type 128 (transform)
fields 0 (all)
compression 1 (none)
modification_mask 7348224 (number_of_points_by_return max_x min_x max_y min_y max_z min_z)
ignore_mask 0
header_size 44
modification size 68
ignore size 0
description size 54
description -keep_class 6 -filtered_transform -set_RGB 200 200 25
:: look at the LAY file applied on the fly
lasview -i fusaRGB.laz -ilay
:: then we make one filtered transform that colors the veggie points
:: pink-ish but use laslayers withoptions '-ilay' and '-add' to append
:: to the (tiny) LAY file instead of creating yet another LAZ file
laslayers -i fusaRGB.laz -ilay ^
-add ^
-keep_class 5 ^
-filtered_transform ^
-set_RGB 250 25 125 ^
-olay
:: print the contents of the modified LAY file
laslayers -i fusaRGB.laz
LASlayer 1 of 3
start_position 276
size 224
type 128 (transform)
fields 0 (all)
compression 1 (none)
modification_mask 7348224 (number_of_points_by_return max_x min_x max_y min_y max_z min_z)
ignore_mask 0
header_size 44
modification size 68
ignore size 0
description size 54
description -keep_class 2 -filtered_transform -set_RGB 50 255 255
LASlayer 2 of 3
start_position 500
size 224
type 128 (transform)
fields 0 (all)
compression 1 (none)
modification_mask 7348224 (number_of_points_by_return max_x min_x max_y min_y max_z min_z)
ignore_mask 0
header_size 44
modification size 68
ignore size 0
description size 54
description -keep_class 6 -filtered_transform -set_RGB 200 200 25
LASlayer 3 of 3
start_position 724
size 224
type 128 (transform)
fields 0 (all)
compression 1 (none)
modification_mask 7348224 (number_of_points_by_return max_x min_x max_y min_y max_z min_z)
ignore_mask 0
header_size 44
modification size 68
ignore size 0
description size 54
description -keep_class 5 -filtered_transform -set_RGB 250 25 125
:: look at the LAY file applied on the fly
lasview -i fusaRGB.laz -ilay
:: apply the 3 LASlayers from the LAY file which is like the "flatten image"
:: operation in GIMP or Photoshop to create the final LAZ file (to deliver
:: to the customer).
laslayers -i fusaRGB.laz -ilay -o fusaRGBfinal.laz
:: look at the "flattened" LAZ file
lasview -i fusaRGBfinal.laz
The attached image shows the result of the last two lasview operations.
Regards,
Martin
PS: For more info on LASlayers see all these links