Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component. More...
Public Types | |
enum | MeshFace { MFFront = 1, MFBack = 2, MFBoth = 3 } |
Public Member Functions | |
PfmFile () | |
PfmFile (PfmFile const copy) | |
bool | calcAveragePoint (Point3 result, float x, float y, float radius) |
Computes the unweighted average point of all points within the box centered at (x, y) with the indicated Manhattan-distance radius. | |
bool | calcMinMax (VBase3 min_points, VBase3 max_points) |
Calculates the minimum and maximum x, y, and z depth component values, representing the bounding box of depth values, and places them in the indicated vectors. | |
clear () | |
Eliminates all data in the file. | |
clear (int x_size, int y_size, int num_channels) | |
Resets to an empty table with a specific size. | |
clearFlatTexcoordName () | |
Resets the flat_texcoord_name to empty, so that additional texture coordinates are not created. | |
BoundingHexahedron | computePlanarBounds (Point2 const center, float point_dist, float sample_radius, bool points_only) |
Computes the minmax bounding volume of the points in 3-D space, assuming the points represent a mostly-planar surface. | |
BoundingHexahedron | computePlanarBounds (float point_dist, float sample_radius) |
This version of this method exists for temporary backward compatibility only. | |
computeSamplePoint (Point3 result, float x, float y, float sample_radius) | |
Computes the average of all the point within sample_radius (manhattan distance) and the indicated point. | |
NodePath | generateVisMesh (MeshFace face) |
Creates a triangle mesh with the points of the pfm as 3-d coordinates in space, and texture coordinates ranging from 0 . | |
NodePath | generateVisMesh () |
Creates a triangle mesh with the points of the pfm as 3-d coordinates in space, and texture coordinates ranging from 0 . | |
NodePath | generateVisPoints () |
Creates a point cloud with the points of the pfm as 3-d coordinates in space, and texture coordinates ranging from 0 . | |
InternalName | getFlatTexcoordName () |
Returns the flat_texcoord_name. | |
int | getNumChannels () |
A pfm file can be either 1-channel (get_num_channels() == 1) or 3-channel (get_num_channels() == 3). | |
Point3 const | getPoint (int x, int y) |
Returns the 3-component point value at the indicated point. | |
float | getScale () |
The "scale" is reported in the pfm header and is probably meaningless. | |
bool | getVis2d () |
Returns the vis_2d flag. | |
bool | getVisInverse () |
Returns the vis_inverse flag. | |
int | getXSize () |
int | getYSize () |
bool | getZeroSpecial () |
Returns the zero_special flag. | |
bool | hasPoint (int x, int y) |
Returns true if there is a valid point at x, y. | |
bool | isValid () |
merge (PfmFile const other) | |
Wherever there is missing data in this PfmFile (that is, wherever has_point() returns false), copy data from the other PfmFile, which must be exactly the same dimensions as this one. | |
Point3 | modifyPoint (int x, int y) |
Returns a modifiable 3-component point value at the indicated point. | |
PfmFile | operator= (PfmFile const copy) |
project (Lens const lens) | |
Adjusts each (x, y, z) point of the Pfm file by projecting it through the indicated lens, converting each point to a (u, v, w) texture coordinate. | |
bool | read (Filename const fullpath) |
Reads the PFM data from the indicated file, returning true on success, false on failure. | |
bool | read (istream in) |
Reads the PFM data from the indicated stream, returning true on success, false on failure. | |
resize (int new_x_size, int new_y_size) | |
Applies a simple filter to resample the pfm file in-place to the indicated size. | |
reverseRows () | |
Performs an in-place reversal of the row (y) data. | |
setFlatTexcoordName (InternalName flat_texcoord_name) | |
If the flat_texcoord_name is specified, it is the name of an additional vertex column that will be created for the "flat" texture coordinates, i.e. | |
setPoint (int x, int y, VBase3 const point) | |
Replaces the 3-component point value at the indicated point. | |
setVis2d (bool vis_2d) | |
Sets the vis_2d flag. | |
setVisInverse (bool vis_inverse) | |
Sets the vis_inverse flag. | |
setZeroSpecial (bool zero_special) | |
Sets the zero_special flag. | |
bool | write (Filename const fullpath) |
Writes the PFM data to the indicated file, returning true on success, false on failure. | |
bool | write (ostream out) |
Writes the PFM data to the indicated stream, returning true on success, false on failure. | |
xform (Mat4 const transform) | |
Applies the indicated transform matrix to all points in-place. |
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component.
enum MeshFace |
PfmFile | ( | ) |
bool calcAveragePoint | ( | Point3 | result, |
float | x, | ||
float | y, | ||
float | radius | ||
) |
Computes the unweighted average point of all points within the box centered at (x, y) with the indicated Manhattan-distance radius.
Missing points are assigned the value of their nearest neighbor. Returns true if successful, or false if the point value cannot be determined.
bool calcMinMax | ( | VBase3 | min_points, |
VBase3 | max_points | ||
) |
Calculates the minimum and maximum x, y, and z depth component values, representing the bounding box of depth values, and places them in the indicated vectors.
Returns true if successful, false if the mesh contains no points.
clear | ( | ) |
Eliminates all data in the file.
Resets the flat_texcoord_name to empty, so that additional texture coordinates are not created.
BoundingHexahedron computePlanarBounds | ( | Point2 const | center, |
float | point_dist, | ||
float | sample_radius, | ||
bool | points_only | ||
) |
Computes the minmax bounding volume of the points in 3-D space, assuming the points represent a mostly-planar surface.
This algorithm works by sampling the (square) sample_radius pixels at the four point_dist corners around the center (cx - pd, cx + pd) and so on, to approximate the plane of the surface. Then all of the points are projected into that plane and the bounding volume of the entire mesh within that plane is determined. If points_only is true, the bounding volume of only those four points is determined.
center, point_dist and sample_radius are in UV space, i.e. in the range 0..1.
BoundingHexahedron computePlanarBounds | ( | float | point_dist, |
float | sample_radius | ||
) |
This version of this method exists for temporary backward compatibility only.
computeSamplePoint | ( | Point3 | result, |
float | x, | ||
float | y, | ||
float | sample_radius | ||
) |
Computes the average of all the point within sample_radius (manhattan distance) and the indicated point.
The point coordinates are given in UV space, in the range 0..1.
NodePath generateVisMesh | ( | MeshFace | face | ) |
Creates a triangle mesh with the points of the pfm as 3-d coordinates in space, and texture coordinates ranging from 0 .
. 1 based on the position within the pfm grid.
Creates a triangle mesh with the points of the pfm as 3-d coordinates in space, and texture coordinates ranging from 0 .
. 1 based on the position within the pfm grid.
Creates a point cloud with the points of the pfm as 3-d coordinates in space, and texture coordinates ranging from 0 .
. 1 based on the position within the pfm grid.
Returns the flat_texcoord_name.
See set_flat_texcoord_name().
int getNumChannels | ( | ) |
A pfm file can be either 1-channel (get_num_channels() == 1) or 3-channel (get_num_channels() == 3).
In the case of a 1-channel file, the values can be found in the x component of each point, and the y and z components are unused.
Returns the 3-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
float getScale | ( | ) |
The "scale" is reported in the pfm header and is probably meaningless.
bool getVis2d | ( | ) |
Returns the vis_2d flag.
See set_vis_2d().
bool getVisInverse | ( | ) |
Returns the vis_inverse flag.
See set_vis_inverse().
bool getZeroSpecial | ( | ) |
Returns the zero_special flag.
When this flag is true, values of (0, 0, 0) in the pfm file are treated as a special case, and are not processed.
Returns true if there is a valid point at x, y.
This always returns true unless the zero_special flag is enabled, in which case it returns false if the point at x, y is zero.
bool isValid | ( | ) |
Point3 modifyPoint | ( | int | x, |
int | y | ||
) |
Returns a modifiable 3-component point value at the indicated point.
Adjusts each (x, y, z) point of the Pfm file by projecting it through the indicated lens, converting each point to a (u, v, w) texture coordinate.
The resulting file can be generated to a mesh (with set_vis_inverse(true) and generate_vis_mesh()) that will apply the lens distortion to an arbitrary texture image.
Reads the PFM data from the indicated file, returning true on success, false on failure.
Reads the PFM data from the indicated stream, returning true on success, false on failure.
Applies a simple filter to resample the pfm file in-place to the indicated size.
Don't confuse this with applying a scale to all of the points via xform().
reverseRows | ( | ) |
Performs an in-place reversal of the row (y) data.
setFlatTexcoordName | ( | InternalName | flat_texcoord_name | ) |
If the flat_texcoord_name is specified, it is the name of an additional vertex column that will be created for the "flat" texture coordinates, i.e.
the original 0..1 values that correspond to the 2-D index position of each point in the original pfm file.
These are the same values that will be assigned to the default texture coordinates if the vis_inverse flag is *not* true.
Replaces the 3-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
setVis2d | ( | bool | vis_2d | ) |
Sets the vis_2d flag.
When this flag is true, only the first two (x, y) value of each depth point is considered meaningful; the z component is ignored. This is only relevant for generating visualizations.
setVisInverse | ( | bool | vis_inverse | ) |
Sets the vis_inverse flag.
When this flag is true, vis meshes and point clouds are generated with the 3-d depth value in the texture coordinates, and the 2-d index value in the vertex position. When it is false, meshes are generated normally, with the 3-d depth value in the vertex position and the 2-d index value in the texture coordinates.
setZeroSpecial | ( | bool | zero_special | ) |
Sets the zero_special flag.
When this flag is true, values of (0, 0, 0) in the pfm file are treated as a special case, and are not processed.
Writes the PFM data to the indicated file, returning true on success, false on failure.
Writes the PFM data to the indicated stream, returning true on success, false on failure.