Calculate RGB colour from intensity

72 views
Skip to first unread message

James Carracher

unread,
May 27, 2024, 3:21:35 AMMay 27
to LAStools - efficient tools for LiDAR processing
Hi,

Sometimes I come across a point cloud that has no colour. Capture at night is an example of this.
Is there a way in lastools to interpolate a colour value (16 bit ideally) from the intensity? I don't always have imagery to colour with.

Similarly, sometimes I get a surveyed point clouds where some scans have colour, but for others the colour hasn't worked. So there is a mix of points with or without colour that overlap each other within the one point cloud. Is there a way to assign colour based on the median colour within a grid size? To find an approximate colour for points that don't have it but are really close to other points that do.

Regards

Jochen Rapidlasso

unread,
May 28, 2024, 3:23:36 PMMay 28
to LAStools - efficient tools for LiDAR processing
Hi James,
converting color to intensity or grayscale is possible using argument "-copy_RGB_into_intensity".
Which formula do you wish to use to convert intensity to a RGB value?
About the 2nd question: Do you have a sample file with example how this should look like?

Thanks,

Jochen @rapidlasso

James Carracher

unread,
May 29, 2024, 1:48:06 AMMay 29
to last...@googlegroups.com

Hi Jochen,

 

I did see that argument in the help file but I didn’t even bother testing it because it seems to go the opposite way to what I want.

 

This is a formula I have used in the past using some very clunky and slow VBA and FME methods. I'm not sure if it's the best one, but it looks good every time I've used it. If you don't correct for gamma with this formula the result is a bit dark. I’ve been standardising a few processes lately so my colleagues can use them automatically without knowing lastools.

 

RGB = integer ( range (intensityoriginal - intensitymin) / (intensitymax - intensitymin) gamma )

 

Intensity original= The intensity of the original point

Intensity min = The minimum intensity value of the entire point cloud

Intensity max = The maximum intensity of the entire point cloud

Gamma = A gamma value (I use 0.5)

Range = The colour range you are targeting. So 255 or 65535

 

I do this in a few steps but it can be done all at once. In words: take away the minimum intensity of the whole point cloud from the target point. Divide that value by the range of possible values in the point cloud. Raise that value by a gamma correction. Multiply by the range of expected values to normalise it. Then round to the nearest integer value. Now assign the same colour to each of the RGB channels

For example, the original intensity is 17152. Subtract the minimum value of 0 from that. The maximum is 65279 (the same as the range) so divide by that to get 0.26275. Raise it to the power of 0.5 to correct for the gamma to give 0.51259. Multiply that by 65535 and make it integer to get an RGB colour value of 33593,33593,33593 to assign to that point

 

I don’t currently have a test file for the second method. I guess it might be a bit hard to do in lastools. What I could do is split out points with/without colour into a new file, then assign it a colour from intensity, then merge back together. When there’s points with/without colour together this has been my basic solution. The points without colour won’t stand out in some software anymore. They stand out because one of our processing software packages assigns a colour of bright green for points without colour and there seems to be no way to change this.

 

James


--
Download LAStools at
https://rapidlasso.de
Manage your settings at
https://groups.google.com/g/lastools/membership
---
You received this message because you are subscribed to a topic in the Google Groups "LAStools - efficient tools for LiDAR processing" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lastools/mnEbBBCsN2M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lastools+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lastools/ec80db00-e1f4-4392-a8c2-6732ab411aedn%40googlegroups.com.

Jochen Rapidlasso

unread,
Nov 26, 2024, 8:27:33 AM (8 days ago) Nov 26
to LAStools - efficient tools for LiDAR processing
Hi James,
with the current version (241125) we release some functions to do RGB/intensity conversion.
las2las64 supports now:
-multiply_scaled_intensity_into_RGB [n] : calculate gray color by (intensity(rel)/intensity(range))*[n]
-multiply_scaled_intensity_into_RGB_red [n]: set red color to [n]*intensity
-multiply_scaled_intensity_into_RGB_green [n] : set green color to [n]*intensity
-multiply_scaled_intensity_into_RGB_blue [n] : set blue color to [n]*intensity   
     
Cheers,

Jochen @rapidlasso
Reply all
Reply to author
Forward
0 new messages