HighMap library (C++)
|
Pyramid decomposition class, to handle low-pass pyramids (like Laplacian pyramid). More...
#include <pyramid.hpp>
Public Member Functions | |
PyramidDecomposition (Array &array, int nlevels) | |
Construct a new Pyramid Decomposition object. | |
void | decompose () |
Generate the pyramid decomposition. | |
Array | reconstruct () |
Reconstruct a field (ideally identical to the input field) based on the pyramid decomposition. | |
void | to_png (std::string fname, int cmap, bool hillshading=false) |
Export pyramid as png image file. | |
Array | transform (std::function< Array(const Array &, const int current_level)> function, int support=0, std::vector< float > level_weights={}, int finest_level=0) |
Apply a transformation to each component of the pyramid and return the field constructed based on the modified pyramid. | |
Public Attributes | |
int | nlevels |
Number of levels in the pyramid. | |
Array | residual |
Residual field (low-pass component) a the coarsest level. | |
std::vector< Array > | components = {} |
High-pass component for each level. | |
std::function< Array(const Array &)> | low_pass_filter_function |
Reference to the low-pass filter function. | |
Pyramid decomposition class, to handle low-pass pyramids (like Laplacian pyramid).
hmap::PyramidDecomposition::PyramidDecomposition | ( | Array & | array, |
int | nlevels | ||
) |
Construct a new Pyramid Decomposition object.
array | Reference to the input array. |
nlevels | Number of levels (if set to a null or negative value, the maximum number of levels is taken minus the number provided). |
Example
Result
void hmap::PyramidDecomposition::decompose | ( | ) |
Generate the pyramid decomposition.
Array hmap::PyramidDecomposition::reconstruct | ( | ) |
Reconstruct a field (ideally identical to the input field) based on the pyramid decomposition.
void hmap::PyramidDecomposition::to_png | ( | std::string | fname, |
int | cmap, | ||
bool | hillshading = false |
||
) |
Export pyramid as png image file.
fname | File name. |
cmap | Colormap ( |
hillshading | Activate hillshading. |
Array hmap::PyramidDecomposition::transform | ( | std::function< Array(const Array &, const int current_level)> | function, |
int | support = 0 , |
||
std::vector< float > | level_weights = {} , |
||
int | finest_level = 0 |
||
) |
Apply a transformation to each component of the pyramid and return the field constructed based on the modified pyramid.
function | Reference to the function applied to the pyramid components. |
support | Function support, should it be applied to the lowpass components only, the highpass only the full field. |
level_weights | Weight in [0, 1] for each level (the resulting component is lerp between no transform and transform according to this weight). |
Example
Result
int hmap::PyramidDecomposition::nlevels |
Number of levels in the pyramid.
Array hmap::PyramidDecomposition::residual |
Residual field (low-pass component) a the coarsest level.
std::vector<Array> hmap::PyramidDecomposition::components = {} |
High-pass component for each level.
Reference to the low-pass filter function.