PTX & Matrix transformation in LAStools

So far, LAStools could already read PTX files. These contain a small header including a rotation/transformation matrix. LAStools read the matrix and stored it in a VLR of the LAS/LAZ result – but without using the header. Now, LAStools supports PTX import and is able to convert the data through the PTX header matrix.

We will show this with a demo file „sample.ptx“:

3
3
0.000000 0.000000 0.000000
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
-0.955179 0.296021 -0.002106 0.000000
-0.296023 -0.955180 0.001152 0.000000
-0.001670 0.001724 0.999997 0.000000
3.847211 12.235314 -0.425777 1.000000
1.111111 2.111111 3.111 0.111
1.222222 2.222222 3.222 0.212
0 0 0 0
0 0 0 0 
1.333333 2.333333 3.333 0.312
1.444444 2.444444 3.444 0.423
0 0 0 0
1.555555 2.555555 3.555 0.534
1.666666 2.666666 3.666 0.678

Reference: CloudCompare and Leica Cyclone.

Import the ptx and export to LAS: sample_cc.las

Convert to text:

las2txt -i sample_cc.las -o sample_cc.txt -parse xyzi -v

lasinfo -i sample_cc.las

2.156 10.553 2.685 0
2.017 10.480 2.796 0
1.877 10.407 2.907 0
1.738 10.334 3.018 0
1.599 10.261 3.129 1
1.460 10.188 3.240 1

The intensity column was converted to integer – but this is not the subject now.

To show what was already possible in previous versions: Put the header into a VLR:

txt2las -i sample.ptx -iptx -parse xyzi -drop_intensity_below 1 -o sample_vlr.laz -v

To test the result, convert this to text:

las2txt -i sample_vlr.laz -o sample_vlr.txt -parse xyzi -v

For testing purposes, this can also be converted in one go:

txt2las -i sample.ptx -iptx -parse xyzi -otxt -o sample_txt.txt -oparse xyzi -drop_intensity_below 1 -v

The result contains only the header matrix as VLR and the raw input values. Use the matrix with the latest version of LAStools (220310) and replace -iptx with -iptx_transform:

txt2las -i sample.ptx -iptx_transform -parse xyzi -drop_intensity_below 1 -o sample_tm.laz -v

Drop the „empty“ lines and convert to txt:

las2txt -i sample_tm.laz -o sample_tm.txt -parse xyzi -v

Result:

2.1557700 10.5530968 2.68 455
2.0165640 10.4800466 2.79 868
1.8773580 10.4069965 2.90 1278
1.7381520 10.3339463 3.01 1732
1.5989293 10.2609134 3.13 2187
1.4597233 10.1878632 3.24 2776

Input intensity column in range [0..1] was converted to a range [0..4096].

So txt2las got the extension to work not only with Helmert and Affine Matrix but also with general 3×3/4×4 matrix. If users want to use this immediately, the new option is ‘-transform_matrix’.
Specify the matrix values ​​as parameters:

[r11 r21 r31 0]
[r12 r22 r32 0]
[r13 r23 r33 0]
[tr1 tr2 tr3 1]
txt2las -iptx -i sample.ptx -transform_matrix ^
 -0.955179,-0.296023,-0.001670  
 0.296021,-0.955180,0.001724 ^
 -0.002106,0.001152,0.999997 ^
 3.847211,12.235314,-0.425777 ^ 
  -parse xyzi -drop_intensity_below 1 -set_scale 0.001 0.001 0.001 ^ 
  -otxt -oparse xyzi -o sample_rm.txt -v

This transformation can be applied to all other files.
Example:

las2las -i france.laz ^
 -transform_matrix ^
 -0.955179,-0.296023,-0.001670  
 0.296021,-0.955180,0.001724 ^
 -0.002106,0.001152,0.999997 ^
 3.847211,12.235314,-0.425777 ^ 
 -o france_mod.laz -v

Limitations:

So far, we just support *1* dataset in a ptx file. If you need this also for multiple datasets please contact us.
The „-transformation_matrix“ argument works also for multiple files.

About PTX files:

Leica LiDAR scanners use this ASCII format to save their data. For details see: http://www.paulbourke.net/dataformats/ptx/

Nach oben scrollen