I wonder if anyone can help me with this. I have an array (single dim) that holds enough uint values to populate a screen 120x160 in size. I want to load the array into a mat and display it as a grayscale image. I am not seeing it can anyone help?? Thanks in advance.
myarray[39360];
//..
//Code populates values between 0 and 255 to the array
// I have printed the array and the values are all 0 to 255
//..
Mat img,img1;
// load the array into a mat
img(120,160,CV_8UC1,myarray);
// convert the mat to a grayscale image, 3 channel instead of the current 1
img.convertTo(img1,CV_8UC3);
namedWindow("test",WINDOW_AUTOSIZE);
imshow("test",img1);
waitKey(0);
// windows pops up but just shows a gray blank page about mid tone :-(