Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I would use Mat::convertTo

// build a cv::Mat over existing data
cv::Mat cvMatFloat(resolutionSize.y,resolutionSize.x,CV_32FC3,(void*)floatImage);
// convert to BGR image
cvMatFloat.convertTo(cvMat,CV_8UC3);

I would use build a cv::Mat over existing data than convert to BGR using Mat::convertTo

// build a cv::Mat over existing data
cv::Mat cvMatFloat(resolutionSize.y,resolutionSize.x,CV_32FC3,(void*)floatImage);
// convert to BGR image
cvMatFloat.convertTo(cvMat,CV_8UC3);