Ask Your Question

Revision history [back]

Check below code, It works fine for me. I didn’t felt any distortion between encode and decode.

Mat src=imread("src.jpg",1);
vector<uchar> buf;
imencode(".jpg",src,buf);

Mat dst=imdecode(buf,1);
imshow("src",src);
imshow("dst",dst);
waitKey();