the previously mentioned method will work fine, if it's PIXEL data.
if instead, you have a whole jpg FILE in memory, headers, compression, and all, it won't work.
in that case you want:
Mat img = imdecode(data);
which will do the same as imread()
, only from memory, not from a filename
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…