|
|
|
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component, or with a special extension, 2- or 4-component.
More...
#include "pfmFile.h"
List of all members.
Classes |
| class | MiniGridCell |
Public Member Functions |
|
| PfmFile (const PfmFile ©) |
| void | apply_crop (int x_begin, int x_end, int y_begin, int y_end) |
| | Reduces the PFM file to the cells in the rectangle bounded by (x_begin, x_end, y_begin, y_end), where the _end cells are not included.
|
| void | box_filter_from (double radius, const PfmFile ©) |
| | Makes a resized copy of the indicated image into this one using the indicated filter.
|
| bool | calc_autocrop (int &x_begin, int &x_end, int &y_begin, int &y_end) const |
| | Computes the minimum range of x and y across the PFM file that include all points.
|
| bool | calc_autocrop (LVecBase4f &range) const |
| | Computes the minimum range of x and y across the PFM file that include all points.
|
| bool | calc_autocrop (LVecBase4d &range) const |
| | Computes the minimum range of x and y across the PFM file that include all points.
|
| bool | calc_average_point (LPoint3f &result, PN_float32 x, PN_float32 y, PN_float32 radius) const |
| | Computes the unweighted average point of all points within the box centered at (x, y) with the indicated Manhattan-distance radius.
|
| bool | calc_bilinear_point (LPoint3f &result, PN_float32 x, PN_float32 y) const |
| | Computes the weighted average of the four nearest points to the floating-point index (x, y).
|
| bool | calc_min_max (LVecBase3f &min_points, LVecBase3f &max_points) const |
| | 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.
|
| bool | calc_tight_bounds (LPoint3f &min_point, LPoint3f &max_point) const |
| | Calculates the minimum and maximum vertices of all points within the table.
|
| void | clear () |
| | Eliminates all data in the file.
|
| void | clear (int x_size, int y_size, int num_channels) |
| | Resets to an empty table with a specific size.
|
| void | clear_no_data_value () |
| | Removes the special value that means "no data" when it appears in the pfm file.
|
| void | clear_to_texcoords (int x_size, int y_size) |
| | Replaces this PfmFile with a new PfmFile of size x_size x y_size x 3, containing the x y 0 values in the range 0 .
|
| void | compute_sample_point (LPoint3f &result, PN_float32 x, PN_float32 y, PN_float32 sample_radius) const |
| | Computes the average of all the point within sample_radius (manhattan distance) and the indicated point.
|
| void | copy_channel (int to_channel, const PfmFile &other, int from_channel) |
| | Copies just the specified channel values from the indicated PfmFile (which could be same as this PfmFile) into the specified channel of this one.
|
| void | copy_sub_image (const PfmFile ©, int xto, int yto, int xfrom=0, int yfrom=0, int x_size=-1, int y_size=-1) |
| | Copies a rectangular area of another image into a rectangular area of this image.
|
| void | fill (PN_float32 value) |
| | Fills the table with all of the same value.
|
| void | fill (const LPoint2f &value) |
| | Fills the table with all of the same value.
|
| void | fill (const LPoint3f &value) |
| | Fills the table with all of the same value.
|
| void | fill (const LPoint4f &value) |
| | Fills the table with all of the same value.
|
| void | fill_channel (int channel, PN_float32 value) |
| | Fills the indicated channel with all of the same value, leaving the other channels unchanged.
|
| void | fill_channel_masked (int channel, PN_float32 value) |
| | Fills the indicated channel with all of the same value, but only where the table already has a data point.
|
| void | fill_channel_masked_nan (int channel) |
| | Fills the indicated channel with NaN, but only where the table already has a data point.
|
| void | fill_channel_nan (int channel) |
| | Fills the indicated channel with NaN, leaving the other channels unchanged.
|
| void | fill_nan () |
| | Fills the table with all NaN.
|
| void | fill_no_data_value () |
| | Fills the table with the current no_data value, so that the table is empty.
|
| void | flip (bool flip_x, bool flip_y, bool transpose) |
| | Reverses, transposes, and/or rotates the table in-place according to the specified parameters.
|
| void | forward_distort (const PfmFile &dist, PN_float32 scale_factor=1.0) |
| | Applies the distortion indicated in the supplied dist map to the current map.
|
| void | gaussian_filter_from (double radius, const PfmFile ©) |
| | Makes a resized copy of the indicated image into this one using the indicated filter.
|
| PN_float32 | get_channel (int x, int y, int c) const |
| | Returns the cth channel of the point value at the indicated point.
|
| const LPoint4f & | get_no_data_value () const |
| | If has_no_data_value() returns true, this returns the particular "no data" value.
|
| const LPoint3f & | get_point (int x, int y) const |
| | Returns the 3-component point value at the indicated point.
|
| PN_float32 | get_point1 (int x, int y) const |
| | Returns the 1-component point value at the indicated point.
|
| const LPoint2f & | get_point2 (int x, int y) const |
| | Returns the 2-component point value at the indicated point.
|
| const LPoint3f & | get_point3 (int x, int y) const |
| | Returns the 3-component point value at the indicated point.
|
| const LPoint4f & | get_point4 (int x, int y) const |
| | Returns the 4-component point value at the indicated point.
|
| PN_float32 | get_scale () const |
| | The "scale" is reported in the pfm header and is probably meaningless.
|
| const vector_float & | get_table () const |
| | This is a very low-level function that returns a read-only reference to the internal table of floating-point numbers.
|
| bool | has_no_data_value () const |
| | Returns whether a "no data" value has been established by set_no_data_value().
|
| bool | has_point (int x, int y) const |
| | Returns true if there is a valid point at x, y.
|
| bool | is_column_empty (int x, int y_begin, int y_end) const |
| | Returns true if all of the points on column x, from [y_begin, y_end), are the no_data value, or false if any one of these points has a value.
|
| bool | is_row_empty (int y, int x_begin, int x_end) const |
| | Returns true if all of the points on row y, in the range [x_begin, x_end), are the no_data value, or false if any one of these points has a value.
|
|
bool | is_valid () const |
| bool | load (const PNMImage &pnmimage) |
| | Fills the PfmFile with the data from the indicated PNMImage, converted to floating-point values.
|
| void | merge (const PfmFile &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.
|
| LPoint3f & | modify_point (int x, int y) |
| | Returns a modifiable 3-component point value at the indicated point.
|
| LPoint2f & | modify_point2 (int x, int y) |
| | Returns a modifiable 2-component point value at the indicated point.
|
| LPoint3f & | modify_point3 (int x, int y) |
| | Returns a modifiable 3-component point value at the indicated point.
|
| LPoint4f & | modify_point4 (int x, int y) |
| | Returns a modifiable 4-component point value at the indicated point.
|
|
void | operator= (const PfmFile ©) |
|
void | output (ostream &out) const |
|
| PT (BoundingHexahedron) compute_planar_bounds(const LPoint2f ¢er |
|
| PT (BoundingHexahedron) compute_planar_bounds(const LPoint2d ¢er |
| int | pull_spot (const LPoint4f &delta, double xc, double yc, double xr, double yr, double exponent) |
| | Applies delta * t to the point values within radius (xr, yr) distance of (xc, yc).
|
| void | quick_filter_from (const PfmFile ©) |
| | Resizes from the given image, with a fixed radius of 0.5.
|
| bool | read (const Filename &fullpath) |
| | Reads the PFM data from the indicated file, returning true on success, false on failure.
|
| bool | read (istream &in, const Filename &fullpath=Filename()) |
| | Reads the PFM data from the indicated stream, returning true on success, false on failure.
|
| bool | read (PNMReader *reader) |
| | Reads the PFM data using the indicated PNMReader.
|
| void | resize (int new_x_size, int new_y_size) |
| | Applies a simple filter to resample the pfm file in-place to the indicated size.
|
| void | reverse_distort (const PfmFile &dist, PN_float32 scale_factor=1.0) |
| | Applies the distortion indicated in the supplied dist map to the current map.
|
| void | reverse_rows () |
| | Performs an in-place reversal of the row (y) data.
|
| void | set_channel (int x, int y, int c, PN_float32 value) |
| | Replaces the cth channel of the point value at the indicated point.
|
| void | set_no_data_chan4 (bool chan4) |
| | Sets the no_data_chan4 flag.
|
| void | set_no_data_nan (int num_channels) |
| | Sets the no_data_nan flag.
|
| void | set_no_data_value (const LPoint4f &no_data_value) |
| | Sets the special value that means "no data" when it appears in the pfm file.
|
| void | set_no_data_value (const LPoint4d &no_data_value) |
| | Sets the special value that means "no data" when it appears in the pfm file.
|
| void | set_point (int x, int y, const LVecBase3f &point) |
| | Replaces the 3-component point value at the indicated point.
|
| void | set_point (int x, int y, const LVecBase3d &point) |
| | Replaces the 3-component point value at the indicated point.
|
| void | set_point1 (int x, int y, PN_float32 point) |
| | Replaces the 1-component point value at the indicated point.
|
| void | set_point2 (int x, int y, const LVecBase2f &point) |
| | Replaces the 2-component point value at the indicated point.
|
| void | set_point2 (int x, int y, const LVecBase2d &point) |
| | Replaces the 2-component point value at the indicated point.
|
| void | set_point3 (int x, int y, const LVecBase3f &point) |
| | Replaces the 3-component point value at the indicated point.
|
| void | set_point3 (int x, int y, const LVecBase3d &point) |
| | Replaces the 3-component point value at the indicated point.
|
| void | set_point4 (int x, int y, const LVecBase4f &point) |
| | Replaces the 4-component point value at the indicated point.
|
| void | set_point4 (int x, int y, const LVecBase4d &point) |
| | Replaces the 4-component point value at the indicated point.
|
| void | set_scale (PN_float32 scale) |
| | The "scale" is reported in the pfm header and is probably meaningless.
|
| void | set_zero_special (bool zero_special) |
| | Sets the zero_special flag.
|
| bool | store (PNMImage &pnmimage) const |
| | Copies the data to the indicated PNMImage, converting to RGB values.
|
| bool | store_mask (PNMImage &pnmimage) const |
| | Stores 1 or 0 values into the indicated PNMImage, according to has_point() for each pixel.
|
| void | swap_table (vector_float &table) |
| | This is a very low-level function that completely exchanges the PfmFile's internal table of floating-point numbers with whatever you supply.
|
| bool | write (const Filename &fullpath) |
| | Writes the PFM data to the indicated file, returning true on success, false on failure.
|
| bool | write (ostream &out, const Filename &fullpath=Filename()) |
| | Writes the PFM data to the indicated stream, returning true on success, false on failure.
|
| bool | write (PNMWriter *writer) |
| | Writes the PFM data using the indicated PNMWriter.
|
| void | xform (const LMatrix4f &transform) |
| | Applies the indicated transform matrix to all points in-place.
|
| void | xform (const LMatrix4d &transform) |
| | Applies the indicated transform matrix to all points in-place.
|
Public Attributes |
PN_float32 PN_float32 bool
points_only | const |
|
PN_float32 | point_dist |
|
PN_float32 PN_float32 | sample_radius |
Friends |
|
class | PfmVizzer |
Detailed Description
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component, or with a special extension, 2- or 4-component.
Definition at line 34 of file pfmFile.h.
Member Function Documentation
Reduces the PFM file to the cells in the rectangle bounded by (x_begin, x_end, y_begin, y_end), where the _end cells are not included.
Definition at line 1477 of file pfmFile.cxx.
Referenced by PfmTrans::process_pfm().
Makes a resized copy of the indicated image into this one using the indicated filter.
The image to be copied is squashed and stretched to match the dimensions of the current image, applying the appropriate filter to perform the stretching.
Definition at line 668 of file pnm-image-filter.cxx.
Referenced by resize().
Computes the minimum range of x and y across the PFM file that include all points.
If there are no points with no_data_value in the grid--that is, all points are included--then this will return (0, get_x_size(), 0, get_y_size()).
Definition at line 425 of file pfmFile.I.
References calc_autocrop().
Computes the minimum range of x and y across the PFM file that include all points.
If there are no points with no_data_value in the grid--that is, all points are included--then this will return (0, get_x_size(), 0, get_y_size()).
Definition at line 442 of file pfmFile.I.
References calc_autocrop().
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.
Definition at line 634 of file pfmFile.cxx.
References get_point(), has_point(), and LPoint3f::zero().
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.
Definition at line 773 of file pfmFile.cxx.
References get_point(), has_point(), and LVecBase3f::zero().
Calculates the minimum and maximum vertices of all points within the table.
Assumes the table contains 3-D points.
The return value is true if any points in the table, or false if none are.
Definition at line 1582 of file pfmFile.cxx.
References get_point(), and has_point().
Resets to an empty table with a specific size.
The case of num_channels == 0 is allowed only in the case that x_size and y_size are also == 0; and this makes an empty (and invalid) PfmFile.
Definition at line 96 of file pfmFile.cxx.
References clear_no_data_value().
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.
Definition at line 1789 of file pfmFile.cxx.
Copies a rectangular area of another image into a rectangular area of this image.
Both images must already have been initialized. The upper-left corner of the region in both images is specified, and the size of the area; if the size is omitted, it defaults to the entire other image, or the largest piece that will fit.
Definition at line 1842 of file pfmFile.cxx.
References get_point(), get_point1(), get_point2(), get_point4(), set_point(), set_point1(), set_point2(), and set_point4().
Fills the table with all of the same value.
Definition at line 401 of file pfmFile.I.
References fill().
Fills the table with all of the same value.
Definition at line 411 of file pfmFile.I.
References fill().
Fills the table with all of the same value.
Definition at line 490 of file pfmFile.cxx.
Fills the indicated channel with NaN, but only where the table already has a data point.
Leaves empty points unchanged.
Definition at line 618 of file pfmFile.cxx.
References fill_channel_masked().
Fills the indicated channel with NaN, leaving the other channels unchanged.
Definition at line 581 of file pfmFile.cxx.
References fill_channel().
Fills the table with the current no_data value, so that the table is empty.
Definition at line 553 of file pfmFile.cxx.
References fill().
Reverses, transposes, and/or rotates the table in-place according to the specified parameters.
If flip_x is true, the x axis is reversed; if flip_y is true, the y axis is reversed. Then, if transpose is true, the x and y axes are exchanged. These parameters can be used to select any combination of 90-degree or 180-degree rotations and flips.
Definition at line 1202 of file pfmFile.cxx.
Referenced by PfmTrans::process_pfm().
Applies the distortion indicated in the supplied dist map to the current map.
The dist map is understood to be a mapping of points in the range 0..1 in the first two dimensions.
The operation can be expressed symbolically as:
this(u, v) = this(dist(u, v))
If scale_factor is not 1, it should be a value > 1, and it specifies the factor to upscale the working table while processing, to reduce artifacts from integer truncation.
By convention, the y axis is inverted in the distortion map relative to the coordinates here. A y value of 0 in the distortion map corresponds with a v value of 1 in this file.
Definition at line 1290 of file pfmFile.cxx.
References clear(), fill(), get_point2(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), has_point(), resize(), set_no_data_value(), and set_point().
Makes a resized copy of the indicated image into this one using the indicated filter.
The image to be copied is squashed and stretched to match the dimensions of the current image, applying the appropriate filter to perform the stretching.
Definition at line 682 of file pnm-image-filter.cxx.
Referenced by resize().
Returns the 3-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
Definition at line 198 of file pfmFile.I.
References get_point3().
Referenced by calc_average_point(), calc_bilinear_point(), PfmVizzer::calc_max_u_displacement(), PfmVizzer::calc_max_v_displacement(), calc_min_max(), calc_tight_bounds(), copy_sub_image(), PfmVizzer::extrude(), PfmVizzer::generate_vis_points(), PfmVizzer::make_displacement(), and merge().
Returns the 3-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
Definition at line 245 of file pfmFile.I.
References LPoint3f::zero().
Referenced by get_point(), and store().
This is a very low-level function that returns a read-only reference to the internal table of floating-point numbers.
Use this method at your own risk.
Definition at line 580 of file pfmFile.I.
Referenced by PNMFileTypePfm::Writer::write_pfm().
Returns true if there is a valid point at x, y.
This always returns true unless a "no data" value has been set, in which case it returns false if the point at x, y is the "no data" value.
Definition at line 57 of file pfmFile.I.
Referenced by calc_average_point(), calc_bilinear_point(), PfmVizzer::calc_max_u_displacement(), PfmVizzer::calc_max_v_displacement(), calc_min_max(), calc_tight_bounds(), PfmVizzer::extrude(), fill_channel_masked(), forward_distort(), PfmVizzer::generate_vis_points(), is_column_empty(), is_row_empty(), PfmVizzer::make_displacement(), merge(), PfmTrans::process_pfm(), PfmVizzer::project(), store_mask(), and xform().
Returns true if all of the points on column x, from [y_begin, y_end), are the no_data value, or false if any one of these points has a value.
Definition at line 879 of file pfmFile.cxx.
References has_point().
Referenced by calc_autocrop().
Returns true if all of the points on row y, in the range [x_begin, x_end), are the no_data value, or false if any one of these points has a value.
Definition at line 855 of file pfmFile.cxx.
References has_point().
Referenced by calc_autocrop().
Fills the PfmFile with the data from the indicated PNMImage, converted to floating-point values.
Definition at line 325 of file pfmFile.cxx.
References clear(), PNMImage::get_alpha(), PNMImage::get_gray(), PNMImageHeader::get_num_channels(), PNMImageHeader::get_x_size(), PNMImage::get_xel(), PNMImageHeader::get_y_size(), and PNMImage::is_valid().
Referenced by Texture::do_store_one(), read(), and PNMImage::write().
Applies delta * t to the point values within radius (xr, yr) distance of (xc, yc).
The t value is scaled from 1.0 at the center to 0.0 at radius (xr, yr), and this scale follows the specified exponent. Returns the number of points affected.
Definition at line 1542 of file pfmFile.cxx.
Reads the PFM data from the indicated stream, returning true on success, false on failure.
This can also handle reading a standard image file supported by PNMImage; it will be quietly converted to a floating-point type.
Definition at line 162 of file pfmFile.cxx.
References clear(), PNMImageHeader::make_reader(), and read().
Applies the distortion indicated in the supplied dist map to the current map.
The dist map is understood to be a mapping of points in the range 0..1 in the first two dimensions.
The operation can be expressed symbolically as:
this(u, v) = dist(this(u, v))
If scale_factor is not 1, it should be a value > 1, and it specifies the factor to upscale the working table while processing, to reduce artifacts from integer truncation.
By convention, the y axis in inverted in the distortion map relative to the coordinates here. A y value of 0 in the distortion map corresponds with a v value of 1 in this file.
Definition at line 1367 of file pfmFile.cxx.
References calc_bilinear_point(), clear(), fill(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), resize(), set_no_data_value(), and set_point().
Performs an in-place reversal of the row (y) data.
Definition at line 1170 of file pfmFile.cxx.
Replaces the cth channel of the point value at the indicated point.
Definition at line 82 of file pfmFile.I.
Referenced by copy_channel().
Sets the no_data_chan4 flag.
When this flag is true, and the pfm file has 4 channels, then a negative value in the fourth channel indicates no data. When it is false, all points are valid.
This is a special case of set_no_data_value().
Definition at line 478 of file pfmFile.I.
References clear_no_data_value().
Replaces the 3-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
Definition at line 222 of file pfmFile.I.
References set_point3().
Replaces the 2-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
Definition at line 169 of file pfmFile.I.
References set_point2().
Replaces the 3-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
Definition at line 290 of file pfmFile.I.
References set_point3().
Replaces the 4-component point value at the indicated point.
In a 1-channel image, the channel value is in the x component.
Definition at line 364 of file pfmFile.I.
References set_point4().
Copies the data to the indicated PNMImage, converting to RGB values.
Definition at line 400 of file pfmFile.cxx.
References PNMImage::clear(), PNMImageHeader::get_num_channels(), get_point2(), get_point3(), get_point4(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), PNMImage::set_alpha(), PNMImage::set_gray(), and PNMImage::set_xel().
Referenced by Texture::do_store_one(), PNMImage::read(), and write().
This is a very low-level function that completely exchanges the PfmFile's internal table of floating-point numbers with whatever you supply.
The provided table must have an appropriate size. Use this method at your own risk.
Definition at line 594 of file pfmFile.I.
Referenced by PNMFileTypePfm::Reader::read_pfm().
Applies the indicated transform matrix to all points in-place.
Definition at line 543 of file pfmFile.I.
References xform().
The documentation for this class was generated from the following files:
| | |