2

How can I add the RGB attributes to a voxel object?

The idea is to give RGB to the colorargument inside the plot function in lidR. And still have the attribute Z as the legend in the RGLwindow. The whole idea is to give sort of realistic colors to the 3D model.

LAS_vox_met = voxel_metrics(LAS_denoised, ~list(N = length(Z)), 0.05) # calculate voxel metrics
plot(LAS_vox_met , color="Z", colorPalette = terrain.colors(50), size = 1, bg = "white", voxels = T, legend = T)

This is what I have produced so far.

enter image description here

2
  • 1
    Does the point-cloud contain RGB attributes?
    – JRR
    Commented Jun 19, 2021 at 8:34
  • Yes, the point cloud contains RGB values Commented Jun 19, 2021 at 8:40

1 Answer 1

2

I'd go for something like

u = ~list(N = length(Z), R = mean(R), G = mean(G), B = mean(B))
LAS_vox_met = voxel_metrics(LAS_denoised, u, 2)
plot(LAS_vox_met , color="RGB", colorPalette = terrain.colors(50), size = 1, bg = "white", voxels = T, legend = T)

enter image description here

1
  • 1
    Notice that voxels = TRUE is a new feature in development in v3.2.0 and not released on CRAN yet. It is better not asking questions that include stuff in development here. In this question it is not a big deal because the question works also without voxels = TRUE
    – JRR
    Commented Jun 19, 2021 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.