#pragma once #include #include #include // Well eventually it might be a contribution namespace cvcontrib { template cv::Point_ as_point(const cv::Size_& s) { return { s.width, s.height }; } template cv::Size_ as_size(const cv::Point_& p) { return { p.x, p.y }; } template inline bool allfinite(const cv::Matx &mat) { const size_t sz = mat.rows*mat.cols; for (size_t i=0; i inline cv::Vec to_vec(const cv::Matx& m) { return cv::Vec{m.val}; } template inline void set_minor(cv::Vec &dst, const int startrow, const cv::Matx &src) { assert (startrow>=0 && startrow+n <= dst.rows); for (int row=startrow, i=0; row inline void set_minor(cv::Matx& dst, const int startrow, int startcol, const cv::Matx &src) { assert (startrow>=0 && startrow+nrows <= dst.rows); assert (startcol>=0 && startcol+ncols <= dst.cols); for (int row=startrow, i=0; row inline cv::Matx cholesky(const cv::Matx& mat) { cv::Matx l = mat; // Der Code ist die Doku! // https://github.com/opencv/opencv/blob/4.5.4/modules/core/src/matrix_decomp.cpp#L95 cv::Cholesky(l.val, l.cols * sizeof(float), n, nullptr, 0, 0); // It doesn't clear the upper triangle so we do it for it. for (int row=0; row