Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

That's pretty easy. Read in the header and keep or discard as you like. Then create a buffer and read the data in from the file.

ushort* ptr = new ushort[width*height];
file.read((uchar*)ptr, width*height*sizeof(ushort));

Then use the Mat constructor

Mat(height, width, CV_16U, ptr);

Remember to delete the buffer when you're done with it. The Mat won't automatically take care of it.