Load a jpg image from memory [closed]
From an IP camera I've read in a jpg image to a buffer in memory. If I write this buffer to a file "picture.jpg", I can open it directly in Windows. I can also open the file with OpenCV: Mat image; image = imread("picture.jpg"); imshow("video", image);
Is there a way to directly pass the memory buffer to OpenCV? Casting it to InputArray ends in error.
Best regards, Peak
imdecode()
Well, as I said, casting the (byte) buffer to InputArray throws an error: OpenCV Error: Assertion failed (0 <= i && i < (int)v.size()) in cv::_InputArray
ok, please show your code.
Cannot paste code. Formats ugly regardless of code window or not
try to read it into
vector<uchar>
not aBYTE *
I did that
again, use a vector, not a pointer
I did that (you see the old code) and it's working now. Thank You!