0

I am newbie in OpenCV. I need to write a C++ program that loads the tiff image stored in the database. So I read the image as char buffer and I'm not sure how to create Mat object from that buffer.

9
  • is that buffer a tiff image ( like on disk, with headers and such ) ? or pixels ? Commented Jan 17, 2014 at 12:18
  • It is image file as such uploaded to the database Commented Jan 17, 2014 at 12:22
  • Content of char buffer is? And format (RGBRGB...RGB)? Commented Jan 17, 2014 at 12:23
  • It is a image file which is uploaded to database as binary data. The C++ program need to read the binary data from the database Commented Jan 17, 2014 at 12:26
  • 1
    docs.opencv.org/modules/highgui/doc/… Commented Jan 17, 2014 at 12:27

1 Answer 1

3

You need:

  1. read the binary data into a std::vector, and then

  2. feed that into imdecode().

    std::vector<char> buffer(data,data+len); 
    Mat img = imdecode(buffer,-1); // use the data as is
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.