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

Function Documentation

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

Returns a zero-copy, non-owning cv::Mat view over a mutable CImage buffer.

No pixel data is copied. The returned Mat shares the CImage memory and remains valid as long as img is alive and not resized.

Requirements: img must be PixelDepth::D8U (the default) and already loaded. Supports CH_GRAY (CV_8UC1), CH_RGB (CV_8UC3), and CH_RGBA (CV_8UC4).