1 | initial version |
One way could be,
Here is an example
Mat img1=imread("1.png",CV_LOAD_IMAGE_COLOR);
Mat img2=imread("2.png",CV_LOAD_IMAGE_COLOR);
Mat combined=img1.clone();
combined.push_back(img2);
vector<uchar> buf1,buf2,buf3;
vector<int> param = vector<int>(2);
param[0]=CV_IMWRITE_JPEG_QUALITY;
param[1]=100;//default(95) 0-100
imencode(".jpg",img1,buf1 ,param);
imencode(".jpg",img2,buf2 ,param);
imencode(".jpg",combined,buf3 ,param);
Mat decoded = imdecode(Mat(buf),CV_LOAD_IMAGE_COLOR);