Ask Your Question

infrared image processing in openCV

asked 2018-01-09 15:48:36 -0500

malharjajoo gravatar image

updated 2018-01-09 15:59:48 -0500


I want to make a small side-project and am considering IR:Infrared (thermal imaging) Cameras. Being a newbie to openCV and never having done image processing with IR images, I would like to know -

  1. Is Image processing ( blurring, feature detection,etc ) for infrared images similar to RGB images ?
  2. Does openCV provide any support for this ?

Thanks a lot !

edit retag flag offensive close merge delete


I don't know which camera you use but imho biggest problem with thermal images is energy calibration.Type IR images are 16 bits or float (and only one channel).

LBerger gravatar imageLBerger ( 2018-01-10 01:37:35 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2018-01-09 22:36:08 -0500

Tetragramm gravatar image

updated 2018-01-09 23:04:01 -0500

All of the basics work. Blurring, morphology, template matching.

About half of the more advanced stuff does too. But particularly in the feature detection and optical flow some don't. Sometimes it's a pretty easy fix, but calcPyrLK is not very easy.

If you want to visualize the image, you can simple use

normalize(image16, image8, 0, 255, NORM_MINMAX, CV_8U)

or, for a better quality, use the CLAHE algorithm

edit flag offensive delete link more


I removed the conversion code from my answer.

sjhalayka gravatar imagesjhalayka ( 2018-01-09 22:52:08 -0500 )edit

I don't recommend using CLAHE or minmax normalization for thermal imaging - except if you want to do purely image processing operations. It will make you lose the temperature data.

I converted the thermal image to 8 bit image using a fixed ratio. For example if your temperature range is between 0-60°C, you can use normalize(image16, image8, 0.25, 0, NORM_L2, CV_8U); (or image16.convertTo(image8,CV_8U,0.25,0);`). Like this, each number will correspond to 1/4°C (the pixel value for 20°C will be 80).

kbarni gravatar imagekbarni ( 2018-01-10 05:10:03 -0500 )edit

That's true. I suppose you do have to be aware of what the numbers actually mean. Sometimes they're meaningful, sometimes (all the IR cameras I use) they aren't.

Tetragramm gravatar imageTetragramm ( 2018-01-10 17:19:28 -0500 )edit

answered 2018-01-09 20:01:55 -0500

sjhalayka gravatar image

updated 2018-01-09 22:51:55 -0500

I'm not sure what camera you're using, but with the Kinect v1.x, the infrared image is greyscale and has a pixel type of unsigned short int (e.g. a 16-bit integer). This type of image is supported by OpenCV (e.g. CV_16UC1), but it might not be supported by certain functions. One function that comes to mind is applyColorMap. It requires that the input image is of type CV_8UC1 or CV_8UC3, and it will give you an assertion failure if you try to pass in an input image of type CV_16UC1.

Why don't you experiment with OpenCV and the CV_16UC1 format before you invest in a camera?

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-01-09 15:48:36 -0500

Seen: 14,285 times

Last updated: Jan 09 '18