39void add_kernel(Array &array,
const Array &kernel,
int i,
int j);
103Array
hstack(
const Array &array1,
const Array &array2);
142std::vector<float>
linspace(
float start,
145 bool endpoint =
true);
170 bool endpoint =
true);
183std::vector<float>
logspace(
float start,
186 bool endpoint =
true);
218 const Array *p_ctrl_param,
219 const Array *p_noise_x,
220 const Array *p_noise_y,
221 const Array *p_stretching,
222 std::function<
float(
float,
float,
float)> fct_xy);
258 const Array *p_ctrl_param,
259 const Array *p_noise_x,
260 const Array *p_noise_y,
261 const Array *p_stretching,
262 std::function<
float(
float,
float,
float)> fct_xy,
290Array
generate_mask(glm::ivec2 shape, std::vector<int> cut_path_i,
int ir);
323 glm::ivec2 patch_shape,
325 bool patch_flip =
false,
326 bool patch_rotate =
false,
327 bool patch_transpose =
false,
328 std::vector<Array *> *p_secondary_arrays =
nullptr,
329 std::vector<Array> *p_secondary_patches =
nullptr);
344std::vector<float>
random_vector(
float min,
float max,
int num,
int seed);
365void rescale_vector(std::vector<float> &vec,
float vmin,
float vmax);
377void swap(Array &a, Array &b);
391Array
vstack(
const Array &array1,
const Array &array2);
406template <
typename Fn>
418 Array result = array;
420 array =
lerp(array, result, *p_mask);
436template <
typename Fn>
442 Array result = fn(array);
445 return lerp(array, result, *p_mask);
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
glm::ivec2 shape
The shape of the array {ni, nj}.
Definition array.hpp:38
Definition algebra.hpp:23
std::vector< float > linspace_jitted(float start, float stop, int num, float ratio, int seed, bool endpoint=true)
Generate a vector of jittered (noised) numbers over a specified interval.
Definition vector.cpp:76
Array get_random_patch(const Array &array, glm::ivec2 patch_shape, std::mt19937 &gen, bool patch_flip=false, bool patch_rotate=false, bool patch_transpose=false, std::vector< Array * > *p_secondary_arrays=nullptr, std::vector< Array > *p_secondary_patches=nullptr)
Extracts a random sub-array (patch) from the input array, with optional transformations.
Definition stitching_helpers.cpp:152
void apply_with_mask(Array &array, const Array *p_mask, Fn &&fn)
Applies a transformation function with optional masked blending.
Definition operator.hpp:407
void rescale_vector(std::vector< float > &vec, float vmin, float vmax)
Rescales the values of a vector to a specified range.
Definition vector.cpp:154
void add_kernel_maximum_smooth(Array &array, const Array &kernel, float k_smooth, int i, int j)
Adds a smoothed maximum value from a kernel to a specified position in a 2D array.
Definition operator.cpp:41
std::vector< float > linspace(float start, float stop, int num, bool endpoint=true)
Generate a vector of evenly spaced numbers over a specified interval.
Definition vector.cpp:51
std::vector< float > random_vector(float min, float max, int num, int seed)
Generate a vector filled with random values within a specified range.
Definition vector.cpp:143
std::vector< float > rescaled_vector(const std::vector< float > &vec, float vmin, float vmax)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition vector.cpp:186
Array vstack(const Array &array1, const Array &array2)
Vertically stack two arrays.
Definition operator.cpp:115
void fill_array_using_xy_function(Array &array, glm::vec4 bbox, const Array *p_ctrl_param, const Array *p_noise_x, const Array *p_noise_y, const Array *p_stretching, std::function< float(float, float, float)> fct_xy)
Fill an array using a scalar function based on (x, y) coordinates.
Definition fill_array.cpp:14
std::vector< float > logspace(float start, float stop, int num, bool endpoint=true)
Generates a logarithmically spaced vector.
Definition vector.cpp:111
Array transform_with_mask(const Array &array, const Array *p_mask, Fn &&fn)
Applies a transformation function with optional masked blending.
Definition operator.hpp:437
void swap(Array &a, Array &b)
Swaps the contents of two Array objects.
Definition operator.cpp:106
bool validate_same_shape(const Array &a, const Array &b, const std::source_location &loc=std::source_location::current())
Validates that two arrays have identical shapes and buffer sizes.
Definition validation.hpp:152
Array inpainting_diffusion(const Array &array, const Array &mask, int iterations)
Perform diffusion-based inpainting to fill a specified region of an array.
Definition inpainting_gaussian.cpp:15
Point lerp(const Point &p1, const Point &p2, float t)
Linearly interpolates between two points.
Definition points.cpp:225
Array compare(const Array &a, const Array &b, float slice_x_pos, float slice_y_pos)
Combines two arrays by selecting values from a or b based on a slice position.
Definition compare.cpp:10
Array hstack(const Array &array1, const Array &array2)
Horizontally stack two arrays side by side.
Definition operator.cpp:76
bool validate_non_empty(const Array &array, const std::source_location &loc=std::source_location::current())
Validates that an array is initialized, non-empty, and has a consistent buffer size.
Definition validation.hpp:58
void find_vertical_cut_path(const Array &error, std::vector< int > &path_i)
Find the vertical cut path with the minimum cost using Dijkstra's algorithm.
Definition stitching_helpers.cpp:28
void add_kernel(Array &array, const Array &kernel, int i, int j)
Add a kernel to a specified position in an array.
Definition operator.cpp:15
Array generate_mask(glm::ivec2 shape, std::vector< int > cut_path_i, int ir)
Generate a smooth mask based on a cut path.
Definition stitching_helpers.cpp:83
Array validation functions with source location logging.