liblas: how to get color of a point cloud's point in las format

971 views Asked by At

I'm using liblas to read a point cloud in las format:

f = file.File(pc_file_path, mode = 'r')

Then I do a for loop on points and I retrieve the color for each point with the following code:

for p in f:
    c = p.color
    print(c.red, c.green, c.blue)

In the print I obtain values with five digits (e.g.: 31232, 26112, 22016) while I expect to find values in the range (0, 250) for each component. What is the scale factor? I've tried with f.header.get_scale() but it doesn't resolve the problem.

1

There are 1 answers

0
Francesco Argese On

Solved multiplying for 256/65535 each color component because the maximum color value is 65535.