file loaded from std::ifstream to opencv image
Hi all,
I have a image file as a byte buffer loaded using a Input stream as below.
std::ifstream is("image.jpg", std::ifstream::binary);
char * buffer; // image.jpg store in this buffer
Now has some difficulties for me to convert this one into a opencv image. Unfortunately I cannot use cvLoadImage function. I tried below but failed.
cv::Mat mat= cv::Mat(imageHeight, imageWidth, CV_8UC3, buffer);
Getting an error when I want to display it.
cv::imshow("Img", mat);
Please help. Thanks