Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I don't know about the TIFF reader, but OpenCV can read and even write 16bit PNG files. You can convert your TIFF to PNG without loss.

This works for me:

cv::Mat input = cv::imread(filename, -1);
click to hide/show revision 2
sentence about writing

I don't know about the TIFF reader, but OpenCV can read and even write 16bit PNG files. You can convert your TIFF to PNG without loss.

This works for me:

cv::Mat input = cv::imread(filename, -1);

To write a matrix 16bit, make sure it has CV_16U format and pass it to imwrite.