From 33447e0bbaacca15cafb978f96ec3fd341e72979 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 21 May 2010 12:07:00 +0000 Subject: [PATCH] fixed mixed-type exp and log functions, used in HMMs (thanks to V. Mityaev) --- modules/imgproc/include/opencv2/imgproc/compat_c.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/imgproc/include/opencv2/imgproc/compat_c.h b/modules/imgproc/include/opencv2/imgproc/compat_c.h index 2a1f8e6f8f..8ff57597ad 100644 --- a/modules/imgproc/include/opencv2/imgproc/compat_c.h +++ b/modules/imgproc/include/opencv2/imgproc/compat_c.h @@ -50,6 +50,7 @@ #ifndef __OPENCV_IMGPROC_COMPAT_C_H__ #define __OPENCV_IMGPROC_COMPAT_C_H__ +#include #include #ifdef __cplusplus @@ -318,17 +319,17 @@ CV_INLINE void cvbReciprocal( const float* x, float* y, int len ) CV_INLINE void cvbFastExp( const float* x, double* y, int len ) { - CvMat mx = cvMat( 1, len, CV_32F, (void*)x ); - CvMat my = cvMat( 1, len, CV_64F, y ); - cvExp( &mx, &my ); + int i; + for( i = 0; i < len; i++ ) + y[i] = exp((double)x[i]); } CV_INLINE void cvbFastLog( const double* x, float* y, int len ) { - CvMat mx = cvMat( 1, len, CV_64F, (void*)x ); - CvMat my = cvMat( 1, len, CV_32F, y ); - cvLog( &mx, &my ); + int i; + for( i = 0; i < len; i++ ) + y[i] = (float)log(x[i]); }