1
我正在将BGR图像转换为YCrCb并将其保存在磁盘中;然而,输出图像是灰色的,我怎样才能将图像保存为带有颜色的磁盘?BGR到YCrCb导致OpenCV中的灰度图像
这里只是我的代码看起来像一个例子:
Mat img = imread("...");
Mat img2;
cvtColor(img, img2, CV_BGR2YCrCb);
vector<Mat> planes;
split(imgColorConverted, planes);
imwrite(".../planes1.jpg", planes[0]);
imwrite(".../planes2.jpg", planes[1]);
imwrite(".../planes3.jpg", planes[2]);
当我打开保存的图像,它是灰色的。是否可以保存图像,我在维基百科上找到以下示例(Wikipedia - YCbCr)?:
谢谢!
你可以尝试做:mat emptyMat(planes [0] .size(),planes [0] .type(),Scalar(255));.你可能会得到更好的视觉效果。 (白色很漂亮:) –