HighMap library (C++)
Loading...
Searching...
No Matches
features.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
13#pragma once
14#include <array>
15
16#include "highmap/array.hpp"
17
41#define HMAP_PACK8(a, b, c, d, e, f, g, h) \
42 ((a << 15) + (b << 13) + (c << 11) + (d << 9) + (e << 7) + (f << 5) + \
43 (g << 3) + (h << 1))
44
45namespace hmap
46{
47
84 const Array &array,
85 float surface_threshold = 0.f,
86 float background_value = 0.f,
87 std::vector<float> *p_surfaces = nullptr,
88 std::vector<std::array<float, 2>> *p_centroids = nullptr);
89
121Array geomorphons(const Array &array, int irmin, int irmax, float epsilon);
122
173Array kmeans_clustering2(const Array &array1,
174 const Array &array2,
175 int nclusters,
176 std::vector<Array> *p_scoring = nullptr,
177 Array *p_aggregate_scoring = nullptr,
178 Vec2<float> weights = {1.f, 1.f},
179 uint seed = 1);
180
224Array kmeans_clustering3(const Array &array1,
225 const Array &array2,
226 const Array &array3,
227 int nclusters,
228 std::vector<Array> *p_scoring = nullptr,
229 Array *p_aggregate_scoring = nullptr,
230 Vec3<float> weights = {1.f, 1.f, 1.f},
231 uint seed = 1);
232
260Array local_median_deviation(const Array &array, int ir);
261
285Array mean_local(const Array &array, int ir);
286
312Array relative_elevation(const Array &array, int ir);
313
335Array ruggedness(const Array &array, int ir);
336
361Array rugosity(const Array &z, int ir, bool convex = true);
362
386Array std_local(const Array &array, int ir);
387
422Array valley_width(const Array &z, int ir = 0, bool ridge_select = false);
423
424Array z_score(const Array &array, int ir);
425
426} // namespace hmap
427
428namespace hmap::gpu
429{
430
432Array local_median_deviation(const Array &array, int ir);
433
435Array mean_local(const Array &array, int ir);
436
438Array relative_elevation(const Array &array, int ir);
439
441Array ruggedness(const Array &array, int ir);
442
444Array rugosity(const Array &z, int ir, bool convex = true);
445
447Array std_local(const Array &array, int ir);
448
450Array z_score(const Array &array, int ir);
451
452} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
unsigned int uint
Definition array.hpp:14
Definition blending.hpp:186
Array local_median_deviation(const Array &array, int ir)
See hmap::local_median_deviation.
Definition features_gpu.cpp:12
Array relative_elevation(const Array &array, int ir)
See hmap::relative_elevation.
Definition features_gpu.cpp:41
Array ruggedness(const Array &array, int ir)
See hmap::ruggedness.
Definition features_gpu.cpp:52
Array z_score(const Array &array, int ir)
See hmap::z_score.
Definition features_gpu.cpp:121
Array rugosity(const Array &z, int ir, bool convex=true)
See hmap::rugosity.
Definition features_gpu.cpp:72
Array std_local(const Array &array, int ir)
See hmap::std_local.
Definition features_gpu.cpp:106
Array mean_local(const Array &array, int ir)
See hmap::mean_local.
Definition features_gpu.cpp:19
Definition algebra.hpp:28
Array std_local(const Array &array, int ir)
Computes the local standard deviation of a 2D array.
Definition features.cpp:118
Array connected_components(const Array &array, float surface_threshold=0.f, float background_value=0.f, std::vector< float > *p_surfaces=nullptr, std::vector< std::array< float, 2 > > *p_centroids=nullptr)
Identifies and labels connected components within a binary or labeled array, with optional filtering ...
Definition connected_components.cpp:14
Array mean_local(const Array &array, int ir)
Return the local mean based on a mean filter with a square kernel.
Definition features.cpp:23
Array z_score(const Array &array, int ir)
Definition features.cpp:146
Array rugosity(const Array &z, int ir, bool convex=true)
Estimates the rugosity of a surface by analyzing the skewness of the elevation data,...
Definition features.cpp:75
Array relative_elevation(const Array &array, int ir)
Calculates the relative elevation within a specified radius, helping to identify local highs and lows...
Definition features.cpp:37
Array local_median_deviation(const Array &array, int ir)
Computes the local median deviation of a 2D array.
Definition features.cpp:16
Array geomorphons(const Array &array, int irmin, int irmax, float epsilon)
Classifies terrain into geomorphological features based on the geomorphons method.
Definition geomorphons.cpp:14
Array valley_width(const Array &z, int ir=0, bool ridge_select=false)
Measures the valley width by calculating the distance from each point in a concave region to the fron...
Definition features.cpp:133
Array kmeans_clustering3(const Array &array1, const Array &array2, const Array &array3, int nclusters, std::vector< Array > *p_scoring=nullptr, Array *p_aggregate_scoring=nullptr, Vec3< float > weights={1.f, 1.f, 1.f}, uint seed=1)
Performs k-means clustering on three input arrays, providing more detailed cluster analysis by consid...
Definition kmeans_clustering.cpp:133
Array kmeans_clustering2(const Array &array1, const Array &array2, int nclusters, std::vector< Array > *p_scoring=nullptr, Array *p_aggregate_scoring=nullptr, Vec2< float > weights={1.f, 1.f}, uint seed=1)
Performs k-means clustering on two input arrays, grouping similar data points into clusters.
Definition kmeans_clustering.cpp:13
Array ruggedness(const Array &array, int ir)
Computes the ruggedness of each element in the input array.
Definition features.cpp:48