tags:

views:

492

answers:

2

Hi,

I have a IPL_DEPTH_32S image (meaning I use 32bit integer to represent pixels) and I need to convert it to IPL_DEPTH_32F, so that I can apply template matching. Does anyone know the formula to convert the integers to floats, or of any functions built in to OpenCV that can do this?

+1  A: 

I don't think opencv has such a function.

The easiest way to do this will be to create a new IPL_DEPTH_32F image with exactly the same size as your IPL_DEPTH_32S image. Then loop over all pixels in both images and for each pixel copy and cast the integer pixel to the float pixel.

Dani van der Meer
+1  A: 

You can simply use "cvConvertImageScale()" to change IPL_DEPTH_32S to IPL_DEPTH_32F.