Runtime error while conversion of color space from RGb to YCbCr
Hello,
I have Y, Cr, Cb channels which I need to combine together into one RGB image. Here is the code I'm using which is giving me run time error. Any help would be appreciated.
CvMat finalLayer; //output to store the merged ycbcr image
cvMerge(y_output, cr_output, cb_output, NULL, &finalLayer); //merging ycbcr
cv::Mat finalLayer1 = cv::cvarrToMat(&finalLayer); //convert IplImage to cv::Mat
cv::Mat finalLayer2; //store RGB output image
cvtColor(finalLayer1, finalLayer2, CV_YCrCb2BGR); //convert from ycbcr to rgb
//display
namedWindow("Final Image",CV_WINDOW_AUTOSIZE);
imshow("Final Image",finalLayer2);waitKey(0);
don't use CvMat, but cv::Mat, don't use cvMerge, but cv::merge. in other words, - avoid using functions from the deprecated c-api.