From cv::Mat to saving image in a given format(png,jpeg...)
Hi,
I am trying to work out how to save an image in a given format (PGM, PNG, JPEG,... ) once I have constructed a cv::Mat
in Header file:
uchar *m_imageData;
uchar* getImageData() const { return m_imageData; }
in class
//c_mrcI being the object that populates m_imageData variable
in main with nxi=4096 and nyi=4096:
cv::Mat *cvmat = new cv::Mat(nxi,nyi,CV_8UC4,c_mrcI->getImageData());
Once I have cvmat I would like to display the content to screen using cvImageShow for example and then save this into a given format (PGM, PNG, JPEG, ...).
Normally I would do:
IplImage *img_jpg = cvLoadImage("some.jpg");
cvNamedWindow("some.jpg", CV_WINDOW_AUTOSIZE);
cvShowImage("some.jpg", img_jpg);
cvWaitKey();
Bu this requires to already have the image some.ext already saved on disk.
So in OpenCV how do we go from cvmat to cvShowImage with and without a disk access?
FB.