Ask Your Question

Revision history [back]

This is the piece of code I used to save a png file:

//Save the output image
cv::Mat frame0; //output of my program
vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_JPEG_QUALITY); // compression technique
compression_params.push_back(98); //compression quality
bool bSuccess = imwrite("hands.png", frame0, compression_params); 

I don't really need to use imencode just those 4 lines.

Hope it helps.