c++opencvimage-processingiplimage

How to convert 8 bit IplImage to 24 bit IplImage in OpenCV?


I have an 8 bit IplImage and I want to convert it to a 24 bit IplImage. How can I do this?


Solution

  • Assuming your gray image is in a variable called image -

    IplImage *rgbimage = cvCreateImage(/*whatever size*/, 8, 3);
    cvCvtColor(image, rgbimage, CV_GRAY2BGR);