I solved the problem by using cv::normalize() to adjust the 12-bit data (stored in 16-bit short integers) down to 8 bit bytes, then the exporting worked fine.
I solved the problem by using cv::normalize() to adjust the 12-bit data (stored in 16-bit short integers) down to 8 bit bytes, then the exporting worked fine.