OpenCV: How to convert CV_8UC1 mat to CV_8UC3

后端 未结 3 1018
后悔当初
后悔当初 2021-01-04 05:25

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         


        
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 05:47

    I've found that the best way to do this is:

    cvtColor(src, dst, COLOR_GRAY2RGB);
    

    The image will look the same as when it was grayscale CV_8UC1 but it will be a 3 channel image of type CV_8UC3.

提交回复
热议问题