Learn R Programming

spanner (version 1.0.2)

merge_las_colors: Merge RGB colors from two colorized LAS objects

Description

Blends the RGB values from two LAS objects to create a new composite coloring. Useful for combining different coloring methods (e.g., ambient occlusion with raster RGB).

Usage

merge_las_colors(las1, las2, alpha = 0.5, method = "alpha")

Value

A LAS object (copy of las1) with merged R, G, and B fields

Arguments

las1

First LAS object with R, G, B fields

las2

Second LAS object with R, G, B fields (must have same number of points as las1)

alpha

Numeric value between 0 and 1 controlling the blend ratio. 0 = all las1 colors, 1 = all las2 colors, 0.5 = equal blend. Default is 0.5.

method

Character string specifying blend method: "alpha" for alpha blending, "multiply" for multiplicative blending, "screen" for screen blending, "overlay" for overlay blending. Default is "alpha".

Details

Blending methods:

alpha

Simple linear interpolation: (1-alpha)las1 + alphalas2

multiply

Multiplicative blend (darkens): (las1 * las2) / 255

screen

Screen blend (lightens): 255 - ((255-las1) * (255-las2)) / 255

overlay

Overlay blend: combines multiply and screen based on base color

Common use cases:

  • Combine ambient occlusion (PCV/SSAO) with aerial RGB for realistic shading

  • Blend attribute coloring with terrain colors

  • Overlay multiple visualization layers

Examples

Run this code
# \donttest{
# Load example LAS file
LASfile <- system.file("extdata", "ALS_Clip.laz", package="spanner")
las <- readLAS(LASfile)

# Combine SSAO ambient occlusion with aerial RGB
las_ao <- colorize_las(las, method="ssao", palette=c("black", "white"))
rgb_file <- system.file("extdata", "UAS_Clip_RGB.tif", package="spanner")
las_rgb <- colorize_las(las, method="rgb", raster_path=rgb_file)
las_merged <- merge_las_colors(las_ao, las_rgb, alpha=0.3, method="multiply")

# Blend attribute coloring with RGB at 50/50
las_height <- colorize_las(las, method="attr", attribute_name="Z",
                           palette=c("blue", "red"))
las_merged <- merge_las_colors(las_height, las_rgb, alpha=0.5)
# }

Run the code above in your browser using DataLab