diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h index 512c1162c..6d40567af 100644 --- a/include/libcamera/internal/matrix.h +++ b/include/libcamera/internal/matrix.h @@ -34,6 +34,11 @@ public: std::copy(data.begin(), data.end(), data_.begin()); } + Matrix(const Span data) + { + std::copy(data.begin(), data.end(), data_.begin()); + } + static constexpr Matrix identity() { Matrix ret; diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp index e7e027225..49e2aa3b4 100644 --- a/src/libcamera/matrix.cpp +++ b/src/libcamera/matrix.cpp @@ -41,6 +41,16 @@ LOG_DEFINE_CATEGORY(Matrix) * number of rows and columns of the matrix (Rows x Cols). */ +/** + * \fn Matrix::Matrix(const Span data) + * \brief Construct a matrix from supplied data + * \param[in] data Data from which to construct a matrix + * + * \a data is a one-dimensional Span and will be turned into a matrix in + * row-major order. The size of \a data must be equal to the product of the + * number of rows and columns of the matrix (Rows x Cols). + */ + /** * \fn Matrix::identity() * \brief Construct an identity matrix