I'm trying to convert a 16UC1 mat to an 8UC3 mat, somehow without truncating the data. Do you have a preferred method? The code I'm trying splits the one 16-bit value into two 8-bit values, which I use for the red and green channels.
UINT16 a = frame_content.at<uint16>(j, i);
BYTE hi = (a >> 8) & 0xff; BYTE low = (a >> 0) & 0xff; byte_frame_content.at<vec3b>(j, i)[0] = hi; byte_frame_content.at<vec3b>(j, i)[1] = low; byte_frame_content.at<vec3b>(j, i)[2] = 0;