PfmFile

from panda3d.core import PfmFile
class PfmFile

Bases: PNMImageHeader

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.

Inheritance diagram

Inheritance diagram of PfmFile

__init__(*args, **kwargs)
addSubImage()

C++ Interface: add_sub_image(const PfmFile self, 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.

*/

add_sub_image()

C++ Interface: add_sub_image(const PfmFile self, 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.

*/

apply1dLut()

C++ Interface: apply_1d_lut(const PfmFile self, int channel, const PfmFile lut, float x_scale)

/**
  • Assumes that lut is an X by 1, 1-component PfmFile whose X axis maps points

  • to target points. For each point in this pfm file, computes: p(u,

  • v)[channel] = lut(p(u, v)[channel] * x_scale, 0)[0]

*/

applyCrop()

C++ Interface: apply_crop(const PfmFile self, 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.

*/

applyExponent()

C++ Interface: apply_exponent(const PfmFile self, float gray_exponent) apply_exponent(const PfmFile self, float gray_exponent, float alpha_exponent) apply_exponent(const PfmFile self, float c0_exponent, float c1_exponent, float c2_exponent) apply_exponent(const PfmFile self, float c0_exponent, float c1_exponent, float c2_exponent, float c3_exponent)

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent.

*/

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent.

*/

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent. For a

  • grayscale image, the blue_exponent value is used for the grayscale value,

  • and red_exponent and green_exponent are unused.

*/

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent.

*/

applyMask()

C++ Interface: apply_mask(const PfmFile self, const PfmFile other)

/**
  • Wherever there is missing data in the other PfmFile, set this the

  • corresponding point in this PfmFile to missing as well, so that this

  • PfmFile has only points where both files have points.

  • The point is set to “missing” by setting it the no_data_value.

*/

apply_1d_lut()

C++ Interface: apply_1d_lut(const PfmFile self, int channel, const PfmFile lut, float x_scale)

/**
  • Assumes that lut is an X by 1, 1-component PfmFile whose X axis maps points

  • to target points. For each point in this pfm file, computes: p(u,

  • v)[channel] = lut(p(u, v)[channel] * x_scale, 0)[0]

*/

apply_crop()

C++ Interface: apply_crop(const PfmFile self, 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.

*/

apply_exponent()

C++ Interface: apply_exponent(const PfmFile self, float gray_exponent) apply_exponent(const PfmFile self, float gray_exponent, float alpha_exponent) apply_exponent(const PfmFile self, float c0_exponent, float c1_exponent, float c2_exponent) apply_exponent(const PfmFile self, float c0_exponent, float c1_exponent, float c2_exponent, float c3_exponent)

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent.

*/

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent.

*/

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent. For a

  • grayscale image, the blue_exponent value is used for the grayscale value,

  • and red_exponent and green_exponent are unused.

*/

/**
  • Adjusts each channel of the image by raising the corresponding component

  • value to the indicated exponent, such that L’ = L ^ exponent.

*/

apply_mask()

C++ Interface: apply_mask(const PfmFile self, const PfmFile other)

/**
  • Wherever there is missing data in the other PfmFile, set this the

  • corresponding point in this PfmFile to missing as well, so that this

  • PfmFile has only points where both files have points.

  • The point is set to “missing” by setting it the no_data_value.

*/

assign()

C++ Interface: assign(const PfmFile self, const PfmFile copy)

boxFilterFrom()

C++ Interface: box_filter_from(const PfmFile self, 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.

*/

box_filter_from()

C++ Interface: box_filter_from(const PfmFile self, 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.

*/

calcAutocrop()

C++ Interface: calc_autocrop(PfmFile self, LVecBase4d range) calc_autocrop(PfmFile self, 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()).

*/

/**
  • 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()).

*/

/**
  • 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()).

*/

calcAveragePoint()

C++ Interface: calc_average_point(PfmFile self, LPoint3f 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.

*/

calcBilinearPoint()

C++ Interface: calc_bilinear_point(PfmFile self, LPoint3f result, float x, float 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.

*/

calcMinMax()

C++ Interface: calc_min_max(PfmFile self, 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.

*/

calcTightBounds()

C++ Interface: calc_tight_bounds(PfmFile self, 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.

  • The return value is true if any points in the table, or false if none are.

*/

calc_autocrop()

C++ Interface: calc_autocrop(PfmFile self, LVecBase4d range) calc_autocrop(PfmFile self, 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()).

*/

/**
  • 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()).

*/

/**
  • 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()).

*/

calc_average_point()

C++ Interface: calc_average_point(PfmFile self, LPoint3f 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.

*/

calc_bilinear_point()

C++ Interface: calc_bilinear_point(PfmFile self, LPoint3f result, float x, float 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.

*/

calc_min_max()

C++ Interface: calc_min_max(PfmFile self, 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.

*/

calc_tight_bounds()

C++ Interface: calc_tight_bounds(PfmFile self, 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.

  • The return value is true if any points in the table, or false if none are.

*/

clear()

C++ Interface: clear(const PfmFile self) clear(const PfmFile self, int x_size, int y_size, int num_channels)

/**
  • Eliminates all data in the file.

*/

/**
  • 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()

C++ Interface: clear_no_data_value(const PfmFile self)

/**
  • Removes the special value that means “no data” when it appears in the pfm

  • file. All points will thus be considered valid.

*/

clearToTexcoords()

C++ Interface: clear_to_texcoords(const PfmFile self, 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.

*/

clear_no_data_value()

C++ Interface: clear_no_data_value(const PfmFile self)

/**
  • Removes the special value that means “no data” when it appears in the pfm

  • file. All points will thus be considered valid.

*/

clear_to_texcoords()

C++ Interface: clear_to_texcoords(const PfmFile self, 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.

*/

computePlanarBounds()

C++ Interface: compute_planar_bounds(PfmFile self, const LPoint2d center, float point_dist, float sample_radius, bool points_only) compute_planar_bounds(PfmFile self, const LPoint2f 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.

*/

/**
  • 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()

C++ Interface: compute_sample_point(PfmFile self, LPoint3f 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.

*/

compute_planar_bounds()

C++ Interface: compute_planar_bounds(PfmFile self, const LPoint2d center, float point_dist, float sample_radius, bool points_only) compute_planar_bounds(PfmFile self, const LPoint2f 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.

*/

/**
  • 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.

*/

compute_sample_point()

C++ Interface: compute_sample_point(PfmFile self, LPoint3f 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.

*/

copyChannel()

C++ Interface: copy_channel(const PfmFile self, 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.

*/

copyChannelMasked()

C++ Interface: copy_channel_masked(const PfmFile self, 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()

C++ Interface: copy_sub_image(const PfmFile self, 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.

*/

copy_channel()

C++ Interface: copy_channel(const PfmFile self, 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.

*/

copy_channel_masked()

C++ Interface: copy_channel_masked(const PfmFile self, 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.

*/

copy_sub_image()

C++ Interface: copy_sub_image(const PfmFile self, 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()

C++ Interface: divide_sub_image(const PfmFile self, 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).

*/

divide_sub_image()

C++ Interface: divide_sub_image(const PfmFile self, 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()

C++ Interface: fill(const PfmFile self, const LPoint4f value) fill(const PfmFile self, const LPoint2f value) fill(const PfmFile self, const LPoint3f value) fill(const PfmFile self, float value)

/**
  • Fills the table with all of the same value.

*/

/**
  • Fills the table with all of the same value.

*/

/**
  • Fills the table with all of the same value.

*/

/**
  • Fills the table with all of the same value.

*/

fillChannel()

C++ Interface: fill_channel(const PfmFile self, int channel, float value)

/**
  • Fills the indicated channel with all of the same value, leaving the other

  • channels unchanged.

*/

fillChannelMasked()

C++ Interface: fill_channel_masked(const PfmFile self, int channel, float 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()

C++ Interface: fill_channel_masked_nan(const PfmFile self, int channel)

/**
  • Fills the indicated channel with NaN, but only where the table already has

  • a data point. Leaves empty points unchanged.

*/

fillChannelNan()

C++ Interface: fill_channel_nan(const PfmFile self, int channel)

/**
  • Fills the indicated channel with NaN, leaving the other channels unchanged.

*/

fillNan()

C++ Interface: fill_nan(const PfmFile self)

/**
  • Fills the table with all NaN.

*/

fillNoDataValue()

C++ Interface: fill_no_data_value(const PfmFile self)

/**
  • Fills the table with the current no_data value, so that the table is empty.

*/

fill_channel()

C++ Interface: fill_channel(const PfmFile self, int channel, float value)

/**
  • Fills the indicated channel with all of the same value, leaving the other

  • channels unchanged.

*/

fill_channel_masked()

C++ Interface: fill_channel_masked(const PfmFile self, int channel, float 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.

*/

fill_channel_masked_nan()

C++ Interface: fill_channel_masked_nan(const PfmFile self, int channel)

/**
  • Fills the indicated channel with NaN, but only where the table already has

  • a data point. Leaves empty points unchanged.

*/

fill_channel_nan()

C++ Interface: fill_channel_nan(const PfmFile self, int channel)

/**
  • Fills the indicated channel with NaN, leaving the other channels unchanged.

*/

fill_nan()

C++ Interface: fill_nan(const PfmFile self)

/**
  • Fills the table with all NaN.

*/

fill_no_data_value()

C++ Interface: fill_no_data_value(const PfmFile self)

/**
  • Fills the table with the current no_data value, so that the table is empty.

*/

flip()

C++ Interface: flip(const PfmFile self, 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()

C++ Interface: forward_distort(const PfmFile self, const PfmFile dist, float 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.

*/

forward_distort()

C++ Interface: forward_distort(const PfmFile self, const PfmFile dist, float 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.

*/

gammaCorrect()

C++ Interface: gamma_correct(const PfmFile self, float from_gamma, float to_gamma)

/**
  • Assuming the image was constructed with a gamma curve of from_gamma in the

  • RGB channels, converts it to an image with a gamma curve of to_gamma in the

  • RGB channels. Does not affect the alpha channel.

*/

gammaCorrectAlpha()

C++ Interface: gamma_correct_alpha(const PfmFile self, float from_gamma, float to_gamma)

/**
  • Assuming the image was constructed with a gamma curve of from_gamma in the

  • alpha channel, converts it to an image with a gamma curve of to_gamma in

  • the alpha channel. Does not affect the RGB channels.

*/

gamma_correct()

C++ Interface: gamma_correct(const PfmFile self, float from_gamma, float to_gamma)

/**
  • Assuming the image was constructed with a gamma curve of from_gamma in the

  • RGB channels, converts it to an image with a gamma curve of to_gamma in the

  • RGB channels. Does not affect the alpha channel.

*/

gamma_correct_alpha()

C++ Interface: gamma_correct_alpha(const PfmFile self, float from_gamma, float to_gamma)

/**
  • Assuming the image was constructed with a gamma curve of from_gamma in the

  • alpha channel, converts it to an image with a gamma curve of to_gamma in

  • the alpha channel. Does not affect the RGB channels.

*/

gaussianFilterFrom()

C++ Interface: gaussian_filter_from(const PfmFile self, 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.

*/

gaussian_filter_from()

C++ Interface: gaussian_filter_from(const PfmFile self, 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.

*/

getChannel()

C++ Interface: get_channel(PfmFile self, int x, int y, int c)

/**
  • Returns the cth channel of the point value at the indicated point.

*/

getNoDataValue()

C++ Interface: get_no_data_value(PfmFile self)

/**
  • If has_no_data_value() returns true, this returns the particular “no data”

  • value.

*/

getPoint()

C++ Interface: get_point(PfmFile self, 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.

*/

getPoint1()

C++ Interface: get_point1(PfmFile self, int x, int y)

/**
  • Returns the 1-component point value at the indicated point.

*/

getPoint2()

C++ Interface: get_point2(PfmFile self, 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.

*/

getPoint3()

C++ Interface: get_point3(PfmFile self, 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.

*/

getPoint4()

C++ Interface: get_point4(PfmFile self, 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.

*/

getPoints()

C++ Interface: get_points(PfmFile self)

getScale()

C++ Interface: get_scale(PfmFile self)

/**
  • The “scale” is reported in the pfm header and is probably meaningless.

*/

get_channel()

C++ Interface: get_channel(PfmFile self, int x, int y, int c)

/**
  • Returns the cth channel of the point value at the indicated point.

*/

get_no_data_value()

C++ Interface: get_no_data_value(PfmFile self)

/**
  • If has_no_data_value() returns true, this returns the particular “no data”

  • value.

*/

get_point()

C++ Interface: get_point(PfmFile self, 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.

*/

get_point1()

C++ Interface: get_point1(PfmFile self, int x, int y)

/**
  • Returns the 1-component point value at the indicated point.

*/

get_point2()

C++ Interface: get_point2(PfmFile self, 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.

*/

get_point3()

C++ Interface: get_point3(PfmFile self, 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.

*/

get_point4()

C++ Interface: get_point4(PfmFile self, 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.

*/

get_points()

C++ Interface: get_points(PfmFile self)

get_scale()

C++ Interface: get_scale(PfmFile self)

/**
  • The “scale” is reported in the pfm header and is probably meaningless.

*/

hasNoDataThreshold()

C++ Interface: has_no_data_threshold(PfmFile self)

/**
  • Returns whether a “no data” threshold value has been established by

  • set_no_data_threshold().

*/

hasNoDataValue()

C++ Interface: has_no_data_value(PfmFile self)

/**
  • Returns whether a “no data” value has been established by

  • set_no_data_value().

*/

hasPoint()

C++ Interface: has_point(PfmFile self, 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.

*/

has_no_data_threshold()

C++ Interface: has_no_data_threshold(PfmFile self)

/**
  • Returns whether a “no data” threshold value has been established by

  • set_no_data_threshold().

*/

has_no_data_value()

C++ Interface: has_no_data_value(PfmFile self)

/**
  • Returns whether a “no data” value has been established by

  • set_no_data_value().

*/

has_point()

C++ Interface: has_point(PfmFile self, 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.

*/

indirect1dLookup()

C++ Interface: indirect_1d_lookup(const PfmFile self, const PfmFile index_image, int channel, const PfmFile pixel_values)

/**
  • index_image is a WxH 1-channel image, while pixel_values is an Nx1

  • image with any number of channels. Typically pixel_values will be

  • a 256x1 image.

  • Fills the PfmFile with a new image the same width and height as

  • index_image, with the same number of channels as pixel_values.

  • Each pixel of the new image is computed with the formula:

  • new_image(x, y) = pixel_values(index_image(x, y)[channel], 0)

  • At present, no interpolation is performed; the nearest value in

  • pixel_values is discovered. This may change in the future.

*/

indirect_1d_lookup()

C++ Interface: indirect_1d_lookup(const PfmFile self, const PfmFile index_image, int channel, const PfmFile pixel_values)

/**
  • index_image is a WxH 1-channel image, while pixel_values is an Nx1

  • image with any number of channels. Typically pixel_values will be

  • a 256x1 image.

  • Fills the PfmFile with a new image the same width and height as

  • index_image, with the same number of channels as pixel_values.

  • Each pixel of the new image is computed with the formula:

  • new_image(x, y) = pixel_values(index_image(x, y)[channel], 0)

  • At present, no interpolation is performed; the nearest value in

  • pixel_values is discovered. This may change in the future.

*/

isColumnEmpty()

C++ Interface: is_column_empty(PfmFile self, 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.

*/

isRowEmpty()

C++ Interface: is_row_empty(PfmFile self, 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.

*/

isValid()

C++ Interface: is_valid(PfmFile self)

/**

*/

is_column_empty()

C++ Interface: is_column_empty(PfmFile self, 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.

*/

is_row_empty()

C++ Interface: is_row_empty(PfmFile self, 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.

*/

is_valid()

C++ Interface: is_valid(PfmFile self)

/**

*/

load()

C++ Interface: load(const PfmFile self, const PNMImage pnmimage)

/**
  • Fills the PfmFile with the data from the indicated PNMImage, converted to

  • floating-point values.

*/

merge()

C++ Interface: merge(const PfmFile self, 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.

*/

modifyPoint()

C++ Interface: modify_point(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 3-component point value at the indicated point.

*/

modifyPoint2()

C++ Interface: modify_point2(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 2-component point value at the indicated point.

*/

modifyPoint3()

C++ Interface: modify_point3(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 3-component point value at the indicated point.

*/

modifyPoint4()

C++ Interface: modify_point4(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 4-component point value at the indicated point.

*/

modify_point()

C++ Interface: modify_point(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 3-component point value at the indicated point.

*/

modify_point2()

C++ Interface: modify_point2(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 2-component point value at the indicated point.

*/

modify_point3()

C++ Interface: modify_point3(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 3-component point value at the indicated point.

*/

modify_point4()

C++ Interface: modify_point4(const PfmFile self, int x, int y)

/**
  • Returns a modifiable 4-component point value at the indicated point.

*/

multSubImage()

C++ Interface: mult_sub_image(const PfmFile self, 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.

*/

mult_sub_image()

C++ Interface: mult_sub_image(const PfmFile self, 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.

*/

output()

C++ Interface: output(PfmFile self, ostream out)

/**

*/

pullSpot()

C++ Interface: pull_spot(const PfmFile self, 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.

*/

pull_spot()

C++ Interface: pull_spot(const PfmFile self, 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()

C++ Interface: quick_filter_from(const PfmFile self, 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.

*/

quick_filter_from()

C++ Interface: quick_filter_from(const PfmFile self, 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.

*/

read()

C++ Interface: read(const PfmFile self, istream in, const Filename fullpath) read(const PfmFile self, 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.

*/

/**
  • 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.

*/

/**
  • Reads the PFM data using the indicated PNMReader.

  • The PNMReader is always deleted upon completion, whether successful or not.

*/

resize()

C++ Interface: resize(const PfmFile self, 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()

C++ Interface: reverse_distort(const PfmFile self, const PfmFile dist, float 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()

C++ Interface: reverse_rows(const PfmFile self)

/**
  • Performs an in-place reversal of the row (y) data.

*/

reverse_distort()

C++ Interface: reverse_distort(const PfmFile self, const PfmFile dist, float 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.

*/

reverse_rows()

C++ Interface: reverse_rows(const PfmFile self)

/**
  • Performs an in-place reversal of the row (y) data.

*/

scale
setChannel()

C++ Interface: set_channel(const PfmFile self, int x, int y, int c, float value)

/**
  • Replaces the cth channel of the point value at the indicated point.

*/

setNoDataChan4()

C++ Interface: set_no_data_chan4(const PfmFile self, 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()

C++ Interface: set_no_data_nan(const PfmFile self, 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()

C++ Interface: set_no_data_threshold(const PfmFile self, const LPoint4d no_data_value) set_no_data_threshold(const PfmFile self, const LPoint4f no_data_value)

/**
  • Sets the special threshold value. Points that are below this value in all

  • components are considered “no value”.

*/

/**
  • Sets the special threshold value. Points that are below this value in all

  • components are considered “no value”.

*/

setNoDataValue()

C++ Interface: set_no_data_value(const PfmFile self, const LPoint4d no_data_value) set_no_data_value(const PfmFile self, const LPoint4f no_data_value)

/**
  • Sets the special value that means “no data” when it appears in the pfm

  • file.

*/

/**
  • Sets the special value that means “no data” when it appears in the pfm

  • file.

*/

setPoint()

C++ Interface: set_point(const PfmFile self, int x, int y, const LVecBase3d point) set_point(const PfmFile self, 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.

*/

/**
  • Replaces the 3-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

setPoint1()

C++ Interface: set_point1(const PfmFile self, int x, int y, float point)

/**
  • Replaces the 1-component point value at the indicated point.

*/

setPoint2()

C++ Interface: set_point2(const PfmFile self, int x, int y, const LVecBase2d point) set_point2(const PfmFile self, 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.

*/

/**
  • Replaces the 2-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

setPoint3()

C++ Interface: set_point3(const PfmFile self, int x, int y, const LVecBase3d point) set_point3(const PfmFile self, 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.

*/

/**
  • Replaces the 3-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

setPoint4()

C++ Interface: set_point4(const PfmFile self, int x, int y, const LVecBase4d point) set_point4(const PfmFile self, 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.

*/

/**
  • Replaces the 4-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

setScale()

C++ Interface: set_scale(const PfmFile self, float scale)

/**
  • The “scale” is reported in the pfm header and is probably meaningless.

*/

setZeroSpecial()

C++ Interface: set_zero_special(const PfmFile self, 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().

*/

set_channel()

C++ Interface: set_channel(const PfmFile self, int x, int y, int c, float value)

/**
  • Replaces the cth channel of the point value at the indicated point.

*/

set_no_data_chan4()

C++ Interface: set_no_data_chan4(const PfmFile self, 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().

*/

set_no_data_nan()

C++ Interface: set_no_data_nan(const PfmFile self, 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().

*/

set_no_data_threshold()

C++ Interface: set_no_data_threshold(const PfmFile self, const LPoint4d no_data_value) set_no_data_threshold(const PfmFile self, const LPoint4f no_data_value)

/**
  • Sets the special threshold value. Points that are below this value in all

  • components are considered “no value”.

*/

/**
  • Sets the special threshold value. Points that are below this value in all

  • components are considered “no value”.

*/

set_no_data_value()

C++ Interface: set_no_data_value(const PfmFile self, const LPoint4d no_data_value) set_no_data_value(const PfmFile self, const LPoint4f no_data_value)

/**
  • Sets the special value that means “no data” when it appears in the pfm

  • file.

*/

/**
  • Sets the special value that means “no data” when it appears in the pfm

  • file.

*/

set_point()

C++ Interface: set_point(const PfmFile self, int x, int y, const LVecBase3d point) set_point(const PfmFile self, 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.

*/

/**
  • Replaces the 3-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

set_point1()

C++ Interface: set_point1(const PfmFile self, int x, int y, float point)

/**
  • Replaces the 1-component point value at the indicated point.

*/

set_point2()

C++ Interface: set_point2(const PfmFile self, int x, int y, const LVecBase2d point) set_point2(const PfmFile self, 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.

*/

/**
  • Replaces the 2-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

set_point3()

C++ Interface: set_point3(const PfmFile self, int x, int y, const LVecBase3d point) set_point3(const PfmFile self, 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.

*/

/**
  • Replaces the 3-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

set_point4()

C++ Interface: set_point4(const PfmFile self, int x, int y, const LVecBase4d point) set_point4(const PfmFile self, 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.

*/

/**
  • Replaces the 4-component point value at the indicated point. In a

  • 1-channel image, the channel value is in the x component.

*/

set_scale()

C++ Interface: set_scale(const PfmFile self, float scale)

/**
  • The “scale” is reported in the pfm header and is probably meaningless.

*/

set_zero_special()

C++ Interface: set_zero_special(const PfmFile self, 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().

*/

store()

C++ Interface: store(PfmFile self, PNMImage pnmimage)

/**
  • Copies the data to the indicated PNMImage, converting to RGB values.

*/

storeMask()

C++ Interface: store_mask(PfmFile self, PNMImage pnmimage) store_mask(PfmFile self, PNMImage pnmimage, const LVecBase4f min_point, const LVecBase4f max_point)

/**
  • 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.

*/

/**
  • 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.

  • This flavor of store_mask also checks whether the valid points are within

  • the specified min/max range. Any valid points without the condition

  • min_point[c] <= value[c] <= max_point[c], for any c, are stored with a 0 in

  • the mask.

*/

store_mask()

C++ Interface: store_mask(PfmFile self, PNMImage pnmimage) store_mask(PfmFile self, PNMImage pnmimage, const LVecBase4f min_point, const LVecBase4f max_point)

/**
  • 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.

*/

/**
  • 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.

  • This flavor of store_mask also checks whether the valid points are within

  • the specified min/max range. Any valid points without the condition

  • min_point[c] <= value[c] <= max_point[c], for any c, are stored with a 0 in

  • the mask.

*/

valid
write()

C++ Interface: write(const PfmFile self, ostream out, const Filename fullpath) write(const PfmFile self, 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.

*/

/**
  • Writes the PFM data to the indicated stream, returning true on success,

  • false on failure.

*/

/**
  • Writes the PFM data using the indicated PNMWriter.

  • The PNMWriter is always deleted upon completion, whether successful or not.

*/

xform()

C++ Interface: xform(const PfmFile self, const LMatrix4d transform) xform(const PfmFile self, const LMatrix4f transform)

/**
  • Applies the indicated transform matrix to all points in-place.

*/

/**
  • Applies the indicated transform matrix to all points in-place.

*/