Reputation: 121
I have an 8 bit IplImage
and I want to convert it to a 24 bit IplImage
. How can I do this?
Upvotes: 0
Views: 1884
Reputation: 28573
You need cvConvertScale this is an example from this question
IplImage *im8 = cvLoadImage(argv[1]);
IplImage *im32 = cvCreateImage(cvSize(im8->width, im8->height), 32, 3);
cvConvertScale(im8, im32, 1/255.);
Upvotes: 3
Reputation: 26279
Assuming your gray image is in a variable called image
-
IplImage *rgbimage = cvCreateImage(/*whatever size*/, 8, 3);
cvCvtColor(image, rgbimage, CV_GRAY2BGR);
Upvotes: 3
Reputation: 5023
Here you go,
Mat input_8Bit;
vector <Mat> Vec_temp_8bit;
Vec_temp_8bit.push_back ( input_8Bit );
Vec_temp_8bit.push_back ( input_8Bit );
Vec_temp_8bit.push_back ( input_8Bit );
Mat Output_24Bit;
merge ( Vec_temp_8bit, Output_24Bit );
Please give a try, I havent checked it. But logically it should work!
Upvotes: 2