HighMap library (C++)
Loading...
Searching...
No Matches
synthesis.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
33
34#pragma once
35
36#include "highmap/array.hpp"
39#include "highmap/transform.hpp"
40
41namespace hmap
42{
43
44struct ComputeMode;
45struct VirtualArray;
46
81 const Array &array,
83 float strength = 1.f,
84 int factor = 4,
85 int patch_size = 16,
86 int analysis_stride = 2,
87 int synthesis_stride = 8,
88 int sparsity = 1,
89 bool flatten_center = false,
90 float flatten_radius = 0.05f);
91
113 glm::ivec2 patch_shape,
114 std::uint32_t seed,
115 float error_threshold = 0.1f);
116
155Array quilting(const std::vector<const Array *> &p_arrays,
156 glm::ivec2 patch_base_shape,
157 glm::ivec2 tiling,
158 float overlap,
159 std::uint32_t seed,
160 std::vector<Array *> secondary_arrays = {},
161 bool patch_flip = true,
162 bool patch_rotate = true,
163 bool patch_transpose = true,
164 float filter_width_ratio = 0.25f);
165
198Array quilting_blend(const std::vector<const Array *> &p_arrays,
199 glm::ivec2 patch_base_shape,
200 float overlap,
201 std::uint32_t seed,
202 bool patch_flip = true,
203 bool patch_rotate = true,
204 bool patch_transpose = true,
205 float filter_width_ratio = 0.25f);
206
244Array quilting_expand(const Array &array,
245 float expansion_ratio,
246 glm::ivec2 patch_base_shape,
247 float overlap,
248 std::uint32_t seed,
249 std::vector<Array *> secondary_arrays = {},
250 bool keep_input_shape = false,
251 bool patch_flip = true,
252 bool patch_rotate = true,
253 bool patch_transpose = true,
254 float filter_width_ratio = 0.25f);
255
289Array quilting_shuffle(const Array &array,
290 glm::ivec2 patch_base_shape,
291 float overlap,
292 std::uint32_t seed,
293 std::vector<Array *> secondary_arrays = {},
294 bool patch_flip = true,
295 bool patch_rotate = true,
296 bool patch_transpose = true,
297 float filter_width_ratio = 0.25f);
298
350 const Array &exemplar,
351 int factor,
352 int patch_size = 16,
353 int analysis_stride = 8,
354 int synthesis_stride = 8,
355 int sparsity = 1);
356
357} // namespace hmap
358
359namespace hmap::gpu
360{
361
386void fill_masked_holes(Array &z,
387 const Array &mask,
388 int iterations_max = 500,
389 float tolerance = 1e-5f,
390 float omega = 0.f,
391 float detail_amplitude = 1.f,
392 int patch_size = 16,
393 std::uint32_t seed = 0,
394 int sync_interval = 1,
395 const UvTile &region = UvTile::unit(),
396 ICommunicator &comm = SingleArrayComm::instance());
397
398} // namespace hmap::gpu
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:31
static SingleArrayComm & instance()
Definition communicator.cpp:78
Lightweight abstract SPMD communicator interface for Array and VirtualArray collective operations.
Definition array_blending.hpp:225
void fill_masked_holes(Array &z, const Array &mask, int iterations_max=500, float tolerance=1e-5f, float omega=0.f, float detail_amplitude=1.f, int patch_size=16, std::uint32_t seed=0, int sync_interval=1, const UvTile &region=UvTile::unit(), ICommunicator &comm=SingleArrayComm::instance())
Fill masked holes in a heightmap by reconstructing the masked regions from the surrounding terrain us...
Definition feature_removal.cpp:254
Definition opencv.hpp:20
Array loose_symmetry(const Array &array, SymmetryType symmetry_type=SymmetryType::SYMMETRY_LEFT_TO_RIGHT, float strength=1.f, int factor=4, int patch_size=16, int analysis_stride=2, int synthesis_stride=8, int sparsity=1, bool flatten_center=false, float flatten_radius=0.05f)
Synthesize a heightmap with natural, approximate symmetry using exemplar-based super-resolution.
Definition loose_symmetry.cpp:39
Array terrain_super_resolution(const Array &array, const Array &exemplar, int factor, int patch_size=16, int analysis_stride=8, int synthesis_stride=8, int sparsity=1)
Synthesize a high-resolution heightmap from a low-resolution input using an exemplar-based sparse pat...
Definition terrain_super_resolution.cpp:328
Array quilting_blend(const std::vector< const Array * > &p_arrays, glm::ivec2 patch_base_shape, float overlap, std::uint32_t seed, bool patch_flip=true, bool patch_rotate=true, bool patch_transpose=true, float filter_width_ratio=0.25f)
Synthesize a new heightmap by stitching together small patches from a list of input heightmaps.
Definition quilting.cpp:233
SymmetryType
Describes the symmetry operation to apply to an array.
Definition transform.hpp:27
@ SYMMETRY_LEFT_TO_RIGHT
Mirror left half onto right half.
Definition transform.hpp:28
UvTile UvTile
Definition communicator_interface.hpp:49
Array quilting_expand(const Array &array, float expansion_ratio, glm::ivec2 patch_base_shape, float overlap, std::uint32_t seed, std::vector< Array * > secondary_arrays={}, bool keep_input_shape=false, bool patch_flip=true, bool patch_rotate=true, bool patch_transpose=true, float filter_width_ratio=0.25f)
Synthesize a new heightmap by expanding the input heightmap and stitching patches.
Definition quilting.cpp:268
Array quilting(const std::vector< const Array * > &p_arrays, glm::ivec2 patch_base_shape, glm::ivec2 tiling, float overlap, std::uint32_t seed, std::vector< Array * > secondary_arrays={}, bool patch_flip=true, bool patch_rotate=true, bool patch_transpose=true, float filter_width_ratio=0.25f)
Synthesize a new heightmap by stitching together small patches from input heightmaps.
Definition quilting.cpp:23
Array quilting_shuffle(const Array &array, glm::ivec2 patch_base_shape, float overlap, std::uint32_t seed, std::vector< Array * > secondary_arrays={}, bool patch_flip=true, bool patch_rotate=true, bool patch_transpose=true, float filter_width_ratio=0.25f)
Synthesize a new heightmap by reshuffling patches of the input heightmap.
Definition quilting.cpp:375
Array non_parametric_sampling(const Array &array, glm::ivec2 patch_shape, std::uint32_t seed, float error_threshold=0.1f)
Synthesize a new heightmap based on an input array using a non-parametric sampling method.
Definition non_parameteric_sampling.cpp:50
Definition virtual_array.hpp:54
static const UvTile & unit()
Definition uv_tile.cpp:31
Definition virtual_array.hpp:65
Umbrella header for all array and texture transformation functions.
Normalized UV-domain tile descriptor for single-source SPMD Array algorithms and VirtualArray dispatc...