Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

read image as array - save array as image

$
0
0
Hello , I just started to study openCV and I am trying to figure how to properly read the image as array. First of all , when I am loading the image using imread , what is the type ? Always unsigned char? So,for example, I am trying to do: ... Mat grayImage; ... unsigned char *myData = grayImage.data; int width = grayImage.cols; int height = grayImage.rows; for(int i = 0; i < height; i++) { for(int j = 0; j < width; j++) { cout << "Mat[ " << i * width + j << " ] = " << (myData[ i * width + j ]) << "\t"; } cout << endl; } I am receiving as output symbols and letters. Also, if I want to store an array as an image what steps must I follow? (I forgot to mention that I want to use pointers in order to access data)

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>