19#include <opencv2/core/mat.hpp>
89 const float &
operator()(
int i,
int j,
int k)
const;
Header file defining basic vector and matrix manipulation classes.
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
A class to represent a multi-dimensional tensor.
Definition tensor.hpp:37
void remap(float vmin=0.f, float vmax=1.f)
Remap the tensor values to a new range.
Definition tensor.cpp:86
float min() const
Find the minimum value in the tensor.
Definition tensor.cpp:81
Array get_slice(int k) const
Get a 2D slice of the tensor along the z-axis.
Definition tensor.cpp:65
float max() const
Find the maximum value in the tensor.
Definition tensor.cpp:76
Vec3< int > shape
Shape of the tensor in 3D space.
Definition tensor.hpp:42
float & operator()(int i, int j, int k)
Access an element of the tensor.
Definition tensor.cpp:55
std::vector< uint8_t > to_img_8bit()
Convert the tensor to an 8-bit image represented as a vector.
Definition tensor.cpp:151
void set_slice(int k, const Array &slice)
Set a 2D slice of the tensor along the z-axis.
Definition tensor.cpp:112
cv::Mat to_cv_mat()
Convert the tensor to an OpenCV matrix.
Definition tensor.cpp:121
std::vector< float > vector
Flattened vector containing the tensor's elements.
Definition tensor.hpp:47
Tensor resample_to_shape_xy(Vec2< int > new_shape_xy)
Resamples the tensor to a new 2D shape (x, y), shape along z is not changed.
Definition tensor.cpp:99
void to_png(const std::string &fname, int depth=CV_8U)
Saves the Tensor as a PNG image file.
Definition tensor.cpp:142
Definition algebra.hpp:28
Vec2 class for basic manipulation of 2D vectors.
Definition algebra.hpp:40
Vec3 class for basic manipulation of 3D vectors.
Definition algebra.hpp:281