Reputation: 63
I am capturing images from a camera and save using opencv as follows.
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);
When saved as .png the image looks good. But saving as .ppm is not giving the expected result. Thanks in advance.
Upvotes: 2
Views: 2898
Reputation: 63
Solved!!!
A conversion from BRGA to BGR did the trick.
cv::Mat leftImage;
cvtColor(leftImage, leftImage, COLOR_BGRA2BGR);
Upvotes: 2