Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can use imdecode for this:

vector<uchar> bytes(data, data+size); // unfortunately, this needs a copy.
Mat m = imdecode(bytes, IMREAD_ANYCOLOR);
imshow("M",m);
waitKey();

you can use imdecode for this:

vector<uchar> bytes(data, data+size); // unfortunately, this needs a copy.
Mat bytes(1, length, CV_8S, data);
Mat m = imdecode(bytes, IMREAD_ANYCOLOR);
imshow("M",m);
waitKey();

you can use imdecode for this:

Mat bytes(1, length, CV_8S, data);
data); // wrap a Mat header around it (no copy)
Mat m = imdecode(bytes, IMREAD_ANYCOLOR);
imshow("M",m);
waitKey();

you can use imdecode for this:

Mat bytes(1, length, CV_8S, data); // wrap a Mat header around it (no copy)
Mat m = imdecode(bytes, IMREAD_ANYCOLOR);
if (! m.empty()) { // did it work ?
    imshow("M",m);
 waitKey();
}