![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GL/ImagePyramid.h>
Represents a pyramid of images with decreasing resolution. More...
Represents a pyramid of images with decreasing resolution.
The first level will always be the original image. All other levels are generated and owned by the object.
Public Member Functions | |
ImagePyramid (SharedImage *input, bool nearestInterpolation=false, bool useCPU=false, bool approximateUniformSpacing=true) | |
Creates a pyramid with one level. | |
const std::vector< SharedImage * > & | levels () const |
Returns a list of all levels sorted from highest to lowest resolution. | |
SharedImage * | level (int i) const |
Returns the image at level i (or nullptr if the level does not exist);. | |
int | createLevels (int numLevels) |
Creates and initializes the levels of the pyramid. | |
void | propagateUp (int level) |
Upsamples the contents of a level to its direct (higher-resolution) predecessor. | |
void | propagateDown (int level) |
Updates the contents of a level to its direct (lower-resolution) child. | |
int | size () const |
Returns the current number of levels. | |
bool | explicitlyResampleMask () |
If true, creates a downsampled ExplicitMask. | |
void | setExplicitlyResampleMask (bool explicitlyResampleMask) |
If set to true, creates a downsampled ExplicitMask. | |
void | setPreserveMaskedPixelsOnPropagateUp (bool preserveMaskedPixelsOnPropagateUp) |
If true, masked values in the next higher level will not be overridden by propagateUp. | |
Protected Attributes | |
std::vector< SharedImage * > | m_levels |
GL::ImageProgram * | m_programDown = nullptr |
GL::ImageProgram * | m_programUp = nullptr |
std::vector< ImageDownsampler > | m_cpuDownsamplers |
bool | m_useCPU |
bool | m_nearestNeighborInterpolation |
bool | m_approximateUniformSpacing = true |
If true, downsample along denser (in terms of spacing) dimensions first. | |
bool | m_explicitlyResampleMask = true |
If true, creates a downsampled ExplicitMask. | |
bool | m_preserveMaskedPixelsOnPropagateUp = false |
Don't update masked pixel on propagateUp. | |
int createLevels | ( | int | numLevels | ) |
Creates and initializes the levels of the pyramid.
Existing levels are deleted. The minimum number of levels will always be one. Each level is computed by downsampling the previous level by factor 2. Once a dimension reaches a size of 2 pixels, it will not be downsampled any further. When all dimension reach this minimum before the desired number of levels is reached, no more levels will be added. If the input image has a mask, the lower levels will be assigned either a downsampled ExplicitMask (independend of the input mask type), a mask that evaluates the original mask directly on the dowsampled image (
void propagateUp | ( | int | level | ) |
Upsamples the contents of a level to its direct (higher-resolution) predecessor.
This method only propagates to the next level and NOT recursively to any further levels. Masks will not be propagated.
level |
|
inline |
If true, creates a downsampled ExplicitMask.
If false
, uses the mask directly with the texture-coordinates of the downsampled image.
|
inline |
If set to true, creates a downsampled ExplicitMask.
If false
, uses the mask directly with the texture-coordinates of the downsampled image.
|
protected |
If true, downsample along denser (in terms of spacing) dimensions first.
To use this, isMetric of the ImageDescriptor of input SharedImage must be true.
|
protected |
If true, creates a downsampled ExplicitMask.
If false
, uses the mask directly with the texture-coordinates of the downsampled image.