2

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.png image. But saving as .ppm.ppm Image is not giving the expected result. Thanks in advance.

SDD123
  • 53
  • 1
  • 12
  • See if [this](https://stackoverflow.com/a/23802333/5008845). Otherwise the format is so simple that's maybe easier to write your own save/load – Miki May 26 '17 at 17:02

1 Answers1

1

Solved!!!

A conversion from BRGA to BGR did the trick.

cv::Mat leftImage;
cvtColor(leftImage, leftImage, COLOR_BGRA2BGR);
SDD123
  • 53
  • 1
  • 12