Panda3D
|
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...
Public Member Functions | |
int | __getbuffer__ (PyBuffer view, int flags) |
__init__ () | |
__init__ (const PfmFile copy) | |
addSubImage (const PfmFile copy, int xto, int yto, int xfrom, int yfrom, int x_size, int y_size, float pixel_scale) | |
Behaves like copy_sub_image(), except the copy pixels are added to the pixels of the destination, after scaling by the specified pixel_scale. More... | |
applyCrop (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. More... | |
boxFilterFrom (float radius, const PfmFile copy) | |
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. More... | |
bool | calcAutocrop (LVecBase4d range) |
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()). More... | |
bool | calcAutocrop (LVecBase4f range) |
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()). More... | |
bool | calcAveragePoint (LPoint3f result, PNFloat32 x, PNFloat32 y, PNFloat32 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. More... | |
bool | calcBilinearPoint (LPoint3f result, PNFloat32 x, PNFloat32 y) |
Computes the weighted average of the four nearest points to the floating-point index (x, y). Returns true if the point has any contributors, false if the point is unknown. More... | |
bool | calcMinMax (LVecBase3f min_points, LVecBase3f 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. More... | |
bool | calcTightBounds (LPoint3f min_point, LPoint3f max_point) |
Calculates the minimum and maximum vertices of all points within the table. Assumes the table contains 3-D points. More... | |
clear () | |
Eliminates all data in the file. More... | |
clear (int x_size, int y_size, int num_channels) | |
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. More... | |
clearNoDataValue () | |
Removes the special value that means "no data" when it appears in the pfm file. All points will thus be considered valid. More... | |
clearToTexcoords (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 .. 1 according to the x y index. More... | |
BoundingHexahedron | computePlanarBounds (const LPoint2d center, PNFloat32 point_dist, PNFloat32 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. More... | |
BoundingHexahedron | computePlanarBounds (const LPoint2f center, PNFloat32 point_dist, PNFloat32 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. More... | |
computeSamplePoint (LPoint3f result, PNFloat32 x, PNFloat32 y, PNFloat32 sample_radius) | |
Computes the average of all the point within sample_radius (manhattan distance) and the indicated point. More... | |
copyChannel (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. More... | |
copyChannelMasked (int to_channel, const PfmFile other, int from_channel) | |
Copies just the specified channel values from the indicated PfmFile, but only where the other file has a data point. More... | |
copySubImage (const PfmFile copy, int xto, int yto, int xfrom, int yfrom, int x_size, int y_size) | |
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. More... | |
divideSubImage (const PfmFile copy, int xto, int yto, int xfrom, int yfrom, int x_size, int y_size, float pixel_scale) | |
Behaves like copy_sub_image(), except the copy pixels are divided into the pixels of the destination, after scaling by the specified pixel_scale. dest(x, y) = dest(x, y) / (copy(x, y) * pixel_scale). More... | |
fill (const LPoint2f value) | |
Fills the table with all of the same value. More... | |
fill (const LPoint3f value) | |
Fills the table with all of the same value. More... | |
fill (const LPoint4f value) | |
Fills the table with all of the same value. More... | |
fill (PNFloat32 value) | |
Fills the table with all of the same value. More... | |
fillChannel (int channel, PNFloat32 value) | |
Fills the indicated channel with all of the same value, leaving the other channels unchanged. More... | |
fillChannelMasked (int channel, PNFloat32 value) | |
Fills the indicated channel with all of the same value, but only where the table already has a data point. Leaves empty points unchanged. More... | |
fillChannelMaskedNan (int channel) | |
Fills the indicated channel with NaN, but only where the table already has a data point. Leaves empty points unchanged. More... | |
fillChannelNan (int channel) | |
Fills the indicated channel with NaN, leaving the other channels unchanged. More... | |
fillNan () | |
Fills the table with all NaN. More... | |
fillNoDataValue () | |
Fills the table with the current no_data value, so that the table is empty. More... | |
flip (bool flip_x, bool flip_y, bool transpose) | |
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. More... | |
forwardDistort (const PfmFile dist, PNFloat32 scale_factor) | |
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. More... | |
gaussianFilterFrom (float radius, const PfmFile copy) | |
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. More... | |
PNFloat32 | getChannel (int x, int y, int c) |
Returns the cth channel of the point value at the indicated point. More... | |
const LPoint4f | getNoDataValue () |
If has_no_data_value() returns true, this returns the particular "no data" value. More... | |
const LPoint3f | getPoint (int x, int y) |
Returns the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
PNFloat32 | getPoint1 (int x, int y) |
Returns the 1-component point value at the indicated point. More... | |
const LPoint2f | getPoint2 (int x, int y) |
Returns the 2-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
const LPoint3f | getPoint3 (int x, int y) |
Returns the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
const LPoint4f | getPoint4 (int x, int y) |
Returns the 4-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
object | getPoints () |
PNFloat32 | getScale () |
The "scale" is reported in the pfm header and is probably meaningless. More... | |
bool | hasNoDataThreshold () |
Returns whether a "no data" threshold value has been established by set_no_data_threshold(). More... | |
bool | hasNoDataValue () |
Returns whether a "no data" value has been established by set_no_data_value(). More... | |
bool | hasPoint (int x, int y) |
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. More... | |
bool | isColumnEmpty (int x, int y_begin, int y_end) |
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. More... | |
bool | isRowEmpty (int y, int x_begin, int x_end) |
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. More... | |
bool | isValid () |
bool | load (const PNMImage pnmimage) |
Fills the PfmFile with the data from the indicated PNMImage, converted to floating-point values. More... | |
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. More... | |
LPoint3f | modifyPoint (int x, int y) |
Returns a modifiable 3-component point value at the indicated point. More... | |
LPoint2f | modifyPoint2 (int x, int y) |
Returns a modifiable 2-component point value at the indicated point. More... | |
LPoint3f | modifyPoint3 (int x, int y) |
Returns a modifiable 3-component point value at the indicated point. More... | |
LPoint4f | modifyPoint4 (int x, int y) |
Returns a modifiable 4-component point value at the indicated point. More... | |
multSubImage (const PfmFile copy, int xto, int yto, int xfrom, int yfrom, int x_size, int y_size, float pixel_scale) | |
Behaves like copy_sub_image(), except the copy pixels are multiplied to the pixels of the destination, after scaling by the specified pixel_scale. More... | |
PfmFile | operator*= (float multiplier) |
PfmFile | operator= (const PfmFile copy) |
output (Ostream out) | |
int | pullSpot (const LPoint4f delta, float xc, float yc, float xr, float yr, float exponent) |
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. More... | |
quickFilterFrom (const PfmFile copy) | |
Resizes from the given image, with a fixed radius of 0.5. This is a very specialized and simple algorithm that doesn't handle dropping below the Nyquist rate very well, but is quite a bit faster than the more general box_filter(), above. More... | |
bool | read (const Filename fullpath) |
Reads the PFM data from the indicated file, returning true on success, false on failure. More... | |
bool | read (PNMReader reader) |
Reads the PFM data using the indicated PNMReader. More... | |
bool | read (Istream in, const Filename fullpath) |
Reads the PFM data from the indicated stream, returning true on success, false on failure. More... | |
resize (int new_x_size, int new_y_size) | |
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(). More... | |
reverseDistort (const PfmFile dist, PNFloat32 scale_factor) | |
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. More... | |
reverseRows () | |
Performs an in-place reversal of the row (y) data. More... | |
setChannel (int x, int y, int c, PNFloat32 value) | |
Replaces the cth channel of the point value at the indicated point. More... | |
setNoDataChan4 (bool chan4) | |
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. More... | |
setNoDataNan (int num_channels) | |
Sets the no_data_nan flag. When num_channels is nonzero, then a NaN value in any of the first num_channels channels indicates no data for that point. If num_channels is zero, then all points are valid. More... | |
setNoDataThreshold (const LPoint4d no_data_value) | |
Sets the special threshold value. Points that are below this value in all components are considered "no
value". More... | |
setNoDataThreshold (const LPoint4f no_data_value) | |
Sets the special threshold value. Points that are below this value in all components are considered "no
value". More... | |
setNoDataValue (const LPoint4d no_data_value) | |
Sets the special value that means "no data" when it appears in the pfm file. More... | |
setNoDataValue (const LPoint4f no_data_value) | |
Sets the special value that means "no data" when it appears in the pfm file. More... | |
setPoint (int x, int y, const LVecBase3d point) | |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setPoint (int x, int y, const LVecBase3f point) | |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setPoint1 (int x, int y, PNFloat32 point) | |
Replaces the 1-component point value at the indicated point. More... | |
setPoint2 (int x, int y, const LVecBase2d point) | |
Replaces the 2-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setPoint2 (int x, int y, const LVecBase2f point) | |
Replaces the 2-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setPoint3 (int x, int y, const LVecBase3d point) | |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setPoint3 (int x, int y, const LVecBase3f point) | |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setPoint4 (int x, int y, const LVecBase4d point) | |
Replaces the 4-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setPoint4 (int x, int y, const LVecBase4f point) | |
Replaces the 4-component point value at the indicated point. In a 1-channel image, the channel value is in the x component. More... | |
setScale (PNFloat32 scale) | |
The "scale" is reported in the pfm header and is probably meaningless. More... | |
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. More... | |
bool | store (PNMImage pnmimage) |
Copies the data to the indicated PNMImage, converting to RGB values. More... | |
bool | storeMask (PNMImage pnmimage) |
Stores 1 or 0 values into the indicated PNMImage, according to has_point() for each pixel. Each valid point gets a 1 value; each nonexistent point gets a 0 value. More... | |
bool | write (const Filename fullpath) |
Writes the PFM data to the indicated file, returning true on success, false on failure. More... | |
bool | write (PNMWriter writer) |
Writes the PFM data using the indicated PNMWriter. More... | |
bool | write (Ostream out, const Filename fullpath) |
Writes the PFM data to the indicated stream, returning true on success, false on failure. More... | |
xform (const LMatrix4d transform) | |
Applies the indicated transform matrix to all points in-place. More... | |
xform (const LMatrix4f transform) | |
Applies the indicated transform matrix to all points in-place. More... | |
![]() | |
__init__ () | |
__init__ (const PNMImageHeader copy) | |
ColorSpace | getColorSpace () |
Returns the color space that the image is encoded in, or CS_unspecified if unknown. More... | |
PNMImageHeader::ColorType | getColorType () |
Returns the image type of the image, as an enumerated value. This is really just the number of channels cast to the enumerated type. More... | |
str | getComment () |
Gets the user comment from the file. More... | |
Xelval | getMaxval () |
Returns the maximum channel value allowable for any pixel in this image; for instance, 255 for a typical 8-bit-per-channel image. A pixel with this value is full on. More... | |
int | getNumChannels () |
Returns the number of channels in the image. More... | |
PNMFileType | getType () |
If the file type is known (e.g. has_type() returns true), returns its PNMFileType pointer; otherwise, returns NULL. More... | |
int | getXSize () |
Returns the number of pixels in the X direction. This is one more than the largest allowable X coordinate. More... | |
int | getYSize () |
Returns the number of pixels in the Y direction. This is one more than the largest allowable Y coordinate. More... | |
bool | hasAlpha () |
Returns true if the image includes an alpha channel, false otherwise. Unlike is_grayscale(), if this returns false it is an error to call any of the functions accessing the alpha channel. More... | |
bool | hasType () |
Returns true if the PNMImageHeader knows what type it is, false otherwise. More... | |
bool | isGrayscale () |
Returns false if the image is a full-color image, and has red, green, and blue components; true if it is a grayscale image and has only a gray component. (The gray color is actually stored in the blue channel, and the red and green channels are ignored.) More... | |
PNMReader | makeReader (const Filename filename, PNMFileType type, bool report_unknown_type) |
Returns a newly-allocated PNMReader of the suitable type for reading from the indicated image filename, or NULL if the filename cannot be read for some reason. The filename "-" always stands for standard input. If type is specified, it is a suggestion for the file type to use. More... | |
PNMReader | makeReader (Istream file, bool owns_file, const Filename filename, str magic_number, PNMFileType type, bool report_unknown_type) |
Returns a newly-allocated PNMReader of the suitable type for reading from the already-opened image file, or NULL if the file cannot be read for some reason. More... | |
PNMWriter | makeWriter (const Filename filename, PNMFileType type) |
Returns a newly-allocated PNMWriter of the suitable type for writing an image to the indicated filename, or NULL if the filename cannot be written for some reason. The filename "-" always stands for standard output. If type is specified, it is a suggestion for the file type to use. More... | |
PNMWriter | makeWriter (Ostream file, bool owns_file, const Filename filename, PNMFileType type) |
Returns a newly-allocated PNMWriter of the suitable type for writing to the already-opened image file, or NULL if the file cannot be written for some reason. More... | |
PNMImageHeader | operator= (const PNMImageHeader copy) |
output (Ostream out) | |
bool | readHeader (const Filename filename, PNMFileType type, bool report_unknown_type) |
Opens up the image file and tries to read its header information to determine its size, number of channels, etc. If successful, updates the header information and returns true; otherwise, returns false. More... | |
bool | readHeader (Istream data, str filename, PNMFileType type, bool report_unknown_type) |
Reads the image header information only from the indicated stream. More... | |
setComment (str comment) | |
Writes a user comment string to the image (header). More... | |
setType (PNMFileType type) | |
Sets the file type of this PNMImage. This will be the default type used when an image is read, if the type cannot be determined by magic number or inferred by extension, or the type used when the image is written, if the type cannot be inferred from the filename extension. More... | |
Additional Inherited Members | |
![]() | |
enum | ColorType { CT_invalid = 0, CT_grayscale = 1, CT_two_channel = 2, CT_color = 3, CT_four_channel = 4 } |
This enumerated type indicates the number of channels in the image, and also implies an image type. You can treat it either as an integer number of channels or as an enumerated image type. More... | |
typedef MapPixelSpecInt | HistMap |
typedef VectorPixelSpec | Palette |
typedef VectorPixelSpecCount | PixelCount |
![]() | |
static bool | hasAlpha (PNMImageHeader::ColorType color_type) |
This static variant of has_alpha() returns true if the indicated image type includes an alpha channel, false otherwise. More... | |
static bool | isGrayscale (PNMImageHeader::ColorType color_type) |
This static variant of is_grayscale() returns true if the indicated image type represents a grayscale image, false otherwise. More... | |
static bool | readMagicNumber (Istream file, String magic_number, int num_bytes) |
Ensures that the first n bytes of the file are read into magic_number. If magic_number is initially nonempty, assumes these represent the first few bytes already extracted. Returns true if successful, false if an end of file or error occurred before num_bytes could be read. More... | |
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.
int __getbuffer__ | ( | PyBuffer | view, |
int | flags | ||
) |
__init__ | ( | ) |
__init__ | ( | const PfmFile | copy | ) |
addSubImage | ( | const PfmFile | copy, |
int | xto, | ||
int | yto, | ||
int | xfrom, | ||
int | yfrom, | ||
int | x_size, | ||
int | y_size, | ||
float | pixel_scale | ||
) |
Behaves like copy_sub_image(), except the copy pixels are added to the pixels of the destination, after scaling by the specified pixel_scale.
applyCrop | ( | 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.
boxFilterFrom | ( | float | radius, |
const PfmFile | copy | ||
) |
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.
bool calcAutocrop | ( | LVecBase4d | range | ) |
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()).
bool calcAutocrop | ( | LVecBase4f | range | ) |
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()).
bool calcAveragePoint | ( | LPoint3f | result, |
PNFloat32 | x, | ||
PNFloat32 | y, | ||
PNFloat32 | 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 calcBilinearPoint | ( | LPoint3f | result, |
PNFloat32 | x, | ||
PNFloat32 | y | ||
) |
Computes the weighted average of the four nearest points to the floating-point index (x, y). Returns true if the point has any contributors, false if the point is unknown.
bool calcMinMax | ( | LVecBase3f | min_points, |
LVecBase3f | 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.
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.
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. 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.
clearNoDataValue | ( | ) |
Removes the special value that means "no data" when it appears in the pfm file. All points will thus be considered valid.
clearToTexcoords | ( | int | x_size, |
int | y_size | ||
) |
BoundingHexahedron computePlanarBounds | ( | const LPoint2d | center, |
PNFloat32 | point_dist, | ||
PNFloat32 | 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 | ( | const LPoint2f | center, |
PNFloat32 | point_dist, | ||
PNFloat32 | 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.
computeSamplePoint | ( | LPoint3f | result, |
PNFloat32 | x, | ||
PNFloat32 | y, | ||
PNFloat32 | 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.
copyChannel | ( | int | to_channel, |
const PfmFile | other, | ||
int | from_channel | ||
) |
copyChannelMasked | ( | int | to_channel, |
const PfmFile | other, | ||
int | from_channel | ||
) |
Copies just the specified channel values from the indicated PfmFile, but only where the other file has a data point.
copySubImage | ( | const PfmFile | copy, |
int | xto, | ||
int | yto, | ||
int | xfrom, | ||
int | yfrom, | ||
int | x_size, | ||
int | y_size | ||
) |
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.
divideSubImage | ( | const PfmFile | copy, |
int | xto, | ||
int | yto, | ||
int | xfrom, | ||
int | yfrom, | ||
int | x_size, | ||
int | y_size, | ||
float | pixel_scale | ||
) |
Behaves like copy_sub_image(), except the copy pixels are divided into the pixels of the destination, after scaling by the specified pixel_scale. dest(x, y) = dest(x, y) / (copy(x, y) * pixel_scale).
fill | ( | const LPoint2f | value | ) |
Fills the table with all of the same value.
fill | ( | const LPoint3f | value | ) |
Fills the table with all of the same value.
fill | ( | const LPoint4f | value | ) |
Fills the table with all of the same value.
fill | ( | PNFloat32 | value | ) |
Fills the table with all of the same value.
fillChannel | ( | int | channel, |
PNFloat32 | value | ||
) |
Fills the indicated channel with all of the same value, leaving the other channels unchanged.
fillChannelMasked | ( | int | channel, |
PNFloat32 | value | ||
) |
Fills the indicated channel with all of the same value, but only where the table already has a data point. Leaves empty points unchanged.
fillChannelMaskedNan | ( | int | channel | ) |
Fills the indicated channel with NaN, but only where the table already has a data point. Leaves empty points unchanged.
fillChannelNan | ( | int | channel | ) |
Fills the indicated channel with NaN, leaving the other channels unchanged.
fillNan | ( | ) |
Fills the table with all NaN.
fillNoDataValue | ( | ) |
Fills the table with the current no_data value, so that the table is empty.
flip | ( | bool | flip_x, |
bool | flip_y, | ||
bool | transpose | ||
) |
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.
forwardDistort | ( | const PfmFile | dist, |
PNFloat32 | scale_factor | ||
) |
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.
gaussianFilterFrom | ( | float | radius, |
const PfmFile | copy | ||
) |
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.
PNFloat32 getChannel | ( | int | x, |
int | y, | ||
int | c | ||
) |
Returns the cth channel of the point value at the indicated point.
const LPoint4f getNoDataValue | ( | ) |
If has_no_data_value() returns true, this returns the particular "no data" value.
const LPoint3f getPoint | ( | int | x, |
int | y | ||
) |
Returns the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
PNFloat32 getPoint1 | ( | int | x, |
int | y | ||
) |
Returns the 1-component point value at the indicated point.
const LPoint2f getPoint2 | ( | int | x, |
int | y | ||
) |
Returns the 2-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
const LPoint3f getPoint3 | ( | int | x, |
int | y | ||
) |
Returns the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
const LPoint4f getPoint4 | ( | int | x, |
int | y | ||
) |
Returns the 4-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
object getPoints | ( | ) |
PNFloat32 getScale | ( | ) |
The "scale" is reported in the pfm header and is probably meaningless.
bool hasNoDataThreshold | ( | ) |
Returns whether a "no data" threshold value has been established by set_no_data_threshold().
bool hasNoDataValue | ( | ) |
Returns whether a "no data" value has been established by set_no_data_value().
bool hasPoint | ( | int | x, |
int | y | ||
) |
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.
bool isColumnEmpty | ( | int | x, |
int | y_begin, | ||
int | y_end | ||
) |
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 isRowEmpty | ( | int | y, |
int | x_begin, | ||
int | x_end | ||
) |
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 isValid | ( | ) |
bool load | ( | const PNMImage | pnmimage | ) |
merge | ( | const PfmFile | other | ) |
LPoint3f modifyPoint | ( | int | x, |
int | y | ||
) |
Returns a modifiable 3-component point value at the indicated point.
LPoint2f modifyPoint2 | ( | int | x, |
int | y | ||
) |
Returns a modifiable 2-component point value at the indicated point.
LPoint3f modifyPoint3 | ( | int | x, |
int | y | ||
) |
Returns a modifiable 3-component point value at the indicated point.
LPoint4f modifyPoint4 | ( | int | x, |
int | y | ||
) |
Returns a modifiable 4-component point value at the indicated point.
multSubImage | ( | const PfmFile | copy, |
int | xto, | ||
int | yto, | ||
int | xfrom, | ||
int | yfrom, | ||
int | x_size, | ||
int | y_size, | ||
float | pixel_scale | ||
) |
Behaves like copy_sub_image(), except the copy pixels are multiplied to the pixels of the destination, after scaling by the specified pixel_scale.
PfmFile operator*= | ( | float | multiplier | ) |
output | ( | Ostream | out | ) |
int pullSpot | ( | const LPoint4f | delta, |
float | xc, | ||
float | yc, | ||
float | xr, | ||
float | yr, | ||
float | exponent | ||
) |
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.
quickFilterFrom | ( | const PfmFile | copy | ) |
Resizes from the given image, with a fixed radius of 0.5. This is a very specialized and simple algorithm that doesn't handle dropping below the Nyquist rate very well, but is quite a bit faster than the more general box_filter(), above.
bool read | ( | const Filename | fullpath | ) |
Reads the PFM data from the indicated file, 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.
bool read | ( | PNMReader | reader | ) |
Reads the PFM data using the indicated PNMReader.
The PNMReader is always deleted upon completion, whether successful or not.
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.
resize | ( | int | new_x_size, |
int | new_y_size | ||
) |
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().
reverseDistort | ( | const PfmFile | dist, |
PNFloat32 | scale_factor | ||
) |
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.
reverseRows | ( | ) |
Performs an in-place reversal of the row (y) data.
setChannel | ( | int | x, |
int | y, | ||
int | c, | ||
PNFloat32 | value | ||
) |
Replaces the cth channel of the point value at the indicated point.
setNoDataChan4 | ( | bool | chan4 | ) |
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().
setNoDataNan | ( | int | num_channels | ) |
Sets the no_data_nan flag. When num_channels is nonzero, then a NaN value in any of the first num_channels channels indicates no data for that point. If num_channels is zero, then all points are valid.
This is a special case of set_no_data_value().
setNoDataThreshold | ( | const LPoint4d | no_data_value | ) |
Sets the special threshold value. Points that are below this value in all components are considered "no value".
setNoDataThreshold | ( | const LPoint4f | no_data_value | ) |
Sets the special threshold value. Points that are below this value in all components are considered "no value".
setNoDataValue | ( | const LPoint4d | no_data_value | ) |
Sets the special value that means "no data" when it appears in the pfm file.
setNoDataValue | ( | const LPoint4f | no_data_value | ) |
Sets the special value that means "no data" when it appears in the pfm file.
setPoint | ( | int | x, |
int | y, | ||
const LVecBase3d | point | ||
) |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setPoint | ( | int | x, |
int | y, | ||
const LVecBase3f | point | ||
) |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setPoint1 | ( | int | x, |
int | y, | ||
PNFloat32 | point | ||
) |
Replaces the 1-component point value at the indicated point.
setPoint2 | ( | int | x, |
int | y, | ||
const LVecBase2d | point | ||
) |
Replaces the 2-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setPoint2 | ( | int | x, |
int | y, | ||
const LVecBase2f | point | ||
) |
Replaces the 2-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setPoint3 | ( | int | x, |
int | y, | ||
const LVecBase3d | point | ||
) |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setPoint3 | ( | int | x, |
int | y, | ||
const LVecBase3f | point | ||
) |
Replaces the 3-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setPoint4 | ( | int | x, |
int | y, | ||
const LVecBase4d | point | ||
) |
Replaces the 4-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setPoint4 | ( | int | x, |
int | y, | ||
const LVecBase4f | point | ||
) |
Replaces the 4-component point value at the indicated point. In a 1-channel image, the channel value is in the x component.
setScale | ( | PNFloat32 | scale | ) |
The "scale" is reported in the pfm header and is probably meaningless.
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.
This is a special case of set_no_data_value().
bool store | ( | PNMImage | pnmimage | ) |
Copies the data to the indicated PNMImage, converting to RGB values.
bool storeMask | ( | PNMImage | pnmimage | ) |
Stores 1 or 0 values into the indicated PNMImage, according to has_point() for each pixel. Each valid point gets a 1 value; each nonexistent point gets a 0 value.
bool write | ( | const Filename | fullpath | ) |
Writes the PFM data to the indicated file, returning true on success, false on failure.
If the type implied by the filename extension supports floating-point, the data will be written directly; otherwise, the floating-point data will be quietly converted to the appropriate integer type.
bool write | ( | PNMWriter | writer | ) |
Writes the PFM data using the indicated PNMWriter.
The PNMWriter is always deleted upon completion, whether successful or not.
Writes the PFM data to the indicated stream, returning true on success, false on failure.
xform | ( | const LMatrix4d | transform | ) |
Applies the indicated transform matrix to all points in-place.
xform | ( | const LMatrix4f | transform | ) |
Applies the indicated transform matrix to all points in-place.