Function mrpt::img::toOpenCVMat(const mrpt::img::CImage&)

Function Documentation

inline cv::Mat mrpt::img::toOpenCVMat(const mrpt::img::CImage &img)

Returns a zero-copy, read-only cv::Mat view over a const CImage buffer.

The const_cast is safe as long as the Mat is not written to; it exists because cv::Mat has no const-data constructor. Prefer toOpenCVMat() on mutable images; use .clone() if you need an independent copy.