Ask Your Question

Revision history [back]

Assuming you retrieve an unsigned char* as your image data from the database, first you have to create the Mat structure that will hold this data:

cv::Mat image(rows, cols, type); //create Mat strucutre
image.data = (unsigned char*) charsFromDataBase; //add the data

cv::imshow("Image", image); //show the image
cv::waitKey(0); //wait until key is pressed

rows and cols are the dimensions of your image. Type is CV_8UC, which means 8bit unsigned char, which is what you have in your data base.