tags:

views:

60

answers:

1

I am trying to process 16-bit single-channel uncompressed TIFF images with OpenCV 2.1, but when I call cvLoadImage, apparently they get converted to 8-bit:

IplImage* img = cvLoadImage("myImage.tif",
      CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR);

std::cout << img->depth << std::endl;

prints

8

The images have been produced by a fluorescence scanner that generates only this kind of images, and I have confirmed with a commercial software package that they really are 16-bit.

How can I open these images and work with the original bit depth?

A: 

Hmm... you could write your own code to load the image. Its uncompressed TIFF, so shouldn't be much trouble.

Utkarsh Sinha
Hi Utkarsh! Thank you very much for your answer. I've been working with OpenCV only for a couple of months. Could you give me a hint about how to do that?
jpromvi
Loading an image isn't an OpenCV thing. You can use fopen and related functions to open the file and load the image pixels. Or you can try libtiff.
Utkarsh Sinha
Thank you very much for your help!!
jpromvi