Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

displaying 16 bit image with stop byte

Hi, I am trying to display a 16 bit image obtained from a scientific CMOS camera. The camera returns an unsigned char array containing height x (2 x width+1) elements. namely, each pixel is encoded as two chars and there is an additional 0-valued char at the end of each row. I have figured out how to load the image into a Mat correctly, by specifying the step as 2*width+1. imwrite also works properly, saving a reasonable image.

My problem is with imshow. The image generated regards the stop byte as the first byte of the next row. Subsequently the displayed image consists of alternating "dark" and "light" rows, as the pixels switch from big endian to little endian and back. Every two rows, there is a 1 pixel shift to the right.

Is there any way of telling imshow to disregard this byte? guy