Ask Your Question

Revision history [back]

Imread() Giving incorrect intensities for a uint8 Tiff [C++]

I used the imread() function to read a 5000 x 5000 UINT8 TIFF(with an indexed color map), however the actual intensities or indexes in the MAT are completely incorrect. I have tried reading the image using the following flags:

cv::IMREAD_UNCHANGED = -1,

cv::IMREAD_GRAYSCALE = 0,

cv::IMREAD_ANYDEPTH = 2,

However, the image intensities are still incorrect. The Image intensities are always displayed correctly in Matlab and ImageJ; however openCV appears to be having some issues. An example of how openCV is currently mapping the intensity values is shown below.

Correct Intensity=> OpenCV Intensity

164=>166

167=>163

146=>186

129=>204

128=>255

Please let me know if you have any questions.

Imread() Giving incorrect intensities for a uint8 Tiff [C++]

I used the imread() function to read a 5000 x 5000 UINT8 TIFF(with an indexed color map), however the actual intensities or indexes in the MAT are completely incorrect. I have tried reading the image using the following flags:

cv::IMREAD_UNCHANGED = -1,

cv::IMREAD_GRAYSCALE = 0,

cv::IMREAD_ANYDEPTH = 2,

However, the image intensities are still incorrect. The Image intensities are always displayed correctly in Matlab and ImageJ; however openCV appears to be having some issues. An example of how openCV is currently mapping the intensity values is shown below.

Correct Intensity=> OpenCV Intensity

164=>166

167=>163

146=>186

129=>204

128=>255

5/3 I looked at the issue again and realized that imread() appears to be reading the colormap values instead of the index values. I need the index values.

Please let me know if you have any questions.