Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You say it's a 17 bit image. Since that can't be stored in 16 bits, how is it being stored? You may need to change your data type from CV_16U to CV_32S. 16U is a 16 bit, unsigned pixel. 32S is a 32 bit, signed pixel. I expect that's the most likely data type to store 17 bit data in. The signed/unsigned difference shouldn't matter, if it's 17 bits then it won't affect the sign bit, so it will be fine.

For your conversion you are, I assume, converting to float or double. You can then use the function normalize(fltImage, normImage, 1, 0, NORM_MINMAX) to do what you described in one step.

Let's get your images good before we worry about the threshold. That's probably best for another question if you try everything you can think of and can't get it to work.