HighMap library (C++)
Loading...
Searching...
No Matches
pyramid.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
15#pragma once
16
17#include <functional>
18
19#include "highmap/array.hpp"
20
21namespace hmap
22{
23
34
40{
41public:
46
51
55 std::vector<Array> components = {};
56
60 std::function<Array(const Array &)> low_pass_filter_function;
61
77
81 void decompose();
82
89
97 void to_png(std::string fname, int cmap, bool hillshading = false);
98
119 std::function<Array(const Array &, const int current_level)> function,
120 int support = 0,
121 std::vector<float> level_weights = {},
122 int finest_level = 0);
123
124private:
128 Array *p_array = nullptr;
129};
130
131} // namespace hmap
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Array class, helper to manipulate 2D float array with "(i, j)" indexing.
Definition array.hpp:32
Pyramid decomposition class, to handle low-pass pyramids (like Laplacian pyramid).
Definition pyramid.hpp:40
void decompose()
Generate the pyramid decomposition.
Definition pyramid_decomposition.cpp:48
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...
Definition pyramid_decomposition.cpp:130
std::function< Array(const Array &)> low_pass_filter_function
Reference to the low-pass filter function.
Definition pyramid.hpp:60
int nlevels
Number of levels in the pyramid.
Definition pyramid.hpp:45
Array reconstruct()
Reconstruct a field (ideally identical to the input field) based on the pyramid decomposition.
Definition pyramid_decomposition.cpp:81
Array residual
Residual field (low-pass component) a the coarsest level.
Definition pyramid.hpp:50
std::vector< Array > components
High-pass component for each level.
Definition pyramid.hpp:55
void to_png(std::string fname, int cmap, bool hillshading=false)
Export pyramid as png image file.
Definition pyramid_decomposition.cpp:101
Definition algebra.hpp:28
pyramid_transform_support
Define on which part of the pyramid component the transform function should be applied.
Definition pyramid.hpp:29
@ HIGHPASS_ONLY
High pass component only.
Definition pyramid.hpp:32
@ FULL
Complete field (sum of low and high pass)
Definition pyramid.hpp:30
@ LOWPASS_ONLY
Low pass component only.
Definition pyramid.hpp:31