How to convert CV_8UC1 Mat to CV_8UC3 with OpenCV?
Mat dst; Mat src(height, width, CV_8UC1, (unsigned char*) captureClient->data()); src.convertTo(dst, CV
The convention is, that for the type CV_8UC3, the pixels values range from 0 to 255, and for type CV_32FC3 from 0.0 to 1.0. Thus you need to use a scaling factor of 255.0, instead of 1.0:
CV_8UC3
0
255
CV_32FC3
0.0
1.0
255.0
Mat::convertTo(newImage, CV_32FC1, 255.0);