PTX file format

From 3D scanning Knowledge base - Photoneo wiki
Jump to: navigation, search

PTX in General

PTX is an ASCII based format for saving point cloud data, typically from LIDAR scanners. Conceptually, information about each 3D point is saved as 4 or 7 values (depending on whether color information is stored or not). The coordinates for each point are saved untransformed in their own coordinate system and the transformation matrix is provided as a header of the file. PTX cannot be used on unordered or unified clouds. All points, even those in shadows where no coordinates have been calculated, are saved.

PTX Header

The header of PTX file contains 10 following rows:

Line # Data
1 Number of rows
2 Number of columns
3 st1 st2 st3 -
4 sx1 sx2 sx3 -
5 sy1 sy2 sy3 -
6 sz1 sz2 sz3 -
7 r11 r12 r13 0
8 r21 r22 r23 0
9 r31 r32 r33 0
10 tr1 tr2 tr3 1

Lines 3-6 of the header are the position of point of origin and primary axes (X, Y, Z) of the scanner coordinate system. Lines 7-10 are the transformation matrix, where lines 7-9 contain the rotation matrix and line 10 the translation vector. The values of lines 3-10 are double precision.

PTX Body

Each line following PTX header contains information about one measured point. If the point cloud does not include information about color the line has 4 values - (X, Y, Z, intensity). The X, Y, Z coordinates are usually in meters. Intensity is in decimal range [0, 1]. Point clouds containing color information have 3 additional numbers per line where the R, G, B values in the [0, 255] range are stated. Sometimes the color can be saved as floats in the range [0, 1].

Photoneo PTX File

In PTX files saved in PhoXi Control the header contains identity matrices in place of the scanner coordinate system and transformation matrix. For any chosen coordinate space the header has the following look:

1544
2064
0 0 0
1 0 0
0 1 0
0 0 1
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

The positions of the points are saved transformed in the chosen coordinate space (camera space, marker space, etc.). The values of the coordinates are in millimeters. The 4th number that usually contains intensity is always set to 1 and the greyscale information from texture is instead saved as the RGB values in the three following numbers.

Saving options for PTX files.
PhoXi Control allows to save the PTX file in five ways with additional option to scale the coordinates by a chosen factor:
  1. Texture
  2. Flip X
  3. Flip Y
  4. Flip Z
  5. Swap YZ

Texture

The texture option saves the greyscale information as RGB values. If this option is not selected the last three numbers in the lines following the header are set to 1.

Flip X

This option saves the X value of point coordinate as their negative.

Original
-96.8908 -159.717 49.0486 1 6 6 6
Flip X
96.8908 -159.717 49.0486 1 6 6 6

Flip Y

This option saves the Y value of point coordinates as their negative.

Original
-96.8908 -159.717 49.0486 1 6 6 6
Flip Y
-96.8908 159.717 49.0486 1 6 6 6

Flip Z

This option saves the Z value of point coordinates as their negative.

Original
-96.8908 -159.717 49.0486 1 6 6 6
Flip Z
-96.8908 -159.717 -49.0486 1 6 6 6

Swap YZ

This option changes the position of Y and Z coordinates in the line. When this number is selected the numbers in line are in the following order: X, Z, Y, intensity, R, G, B.

Original
-96.8908 -159.717 49.0486 1 6 6 6
Swap YZ
-96.8908 49.0486 -159.717 1 6 6 6

Scale

Scale allows to multiply the X, Y, Z coordinates by a selected number. By default this number is set to 1 and the X, Y, Z are in millimeters.

Scale 1.0000
-96.8908 -159.717 49.0486 1 6 6 6
Scale 1000.0000
-96890.8 -159717.0 49048.6 1 6 6 6