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?
Asked
Active
Viewed 2,463 times
2 Answers
3
You can simply use "cvConvertImageScale()" to change IPL_DEPTH_32S to IPL_DEPTH_32F.
1
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
- 6,169
- 3
- 26
- 45