Here is my code I am using to convert *IplImage to jpg:
IplImage* fIplImageHeader; fIplImageHeader = cvCreateImageHeader(cvSize(160, 120), 8, 3); fIplImageHeader
Ok. I've figured this out. This works:
cv::imencode(".jpg", fIplImageHeader, buf, p);
They should mention it somewhere in the documentation that there should be a full stop before extension.