.ppm图像使用opencv保存错误

时间:2017-05-26 14:32:20

标签: c++ opencv

我正在从相机捕捉图像并使用opencv保存如下。

cv::Mat leftImage(height, width, CV_8UC3);
//capturing image here
vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_PXM_BINARY);
compression_params.push_back(1);

 //writing as ppm image
 cv::imwrite("Image_1.ppm", leftImage, compression_params);

当保存为.png时,图像看起来很不错.png image。但是保存为.ppm .ppm Image并没有给出预期的结果。提前致谢。

1 个答案:

答案 0 :(得分:1)

解决!!!

从BRGA到BGR的转换成功了。

cv::Mat leftImage;
cvtColor(leftImage, leftImage, COLOR_BGRA2BGR);