]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed several compiler warnings and errs
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Sat, 27 Sep 2008 22:15:32 +0000 (22:15 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Sat, 27 Sep 2008 22:15:32 +0000 (22:15 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@1293 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/src/cv/cvcalibinit.cpp
opencv/src/cv/cvsurf.cpp
opencv/src/cxcore/cxutils.cpp

index ea7ff044548c40d2894dd122d50d9847f587ab77..e4a29eebcc04a372e3d0d1582374bc83cf15e309 100644 (file)
 \************************************************************************************/
 
 #include "_cv.h"
+#include <stdarg.h>
 
 //#define DEBUG_CHESSBOARD
 #ifdef DEBUG_CHESSBOARD
-#define PRINTF printf
+static int PRINTF( const char* fmt, ... )
+{
+    va_list args;
+    va_start(args, fmt);
+    return vprintf(fmt, args);
+}
 #include "..//..//otherlibs/highgui/highgui.h"
 #else
-#define PRINTF(x,...)
+static int PRINTF( const char*, ... )
+{
+    return 0;
+}
 #endif
 
 
index dcd95d3bcf4eefc4a2eb357e2259cde829c6fcf6..2eb7f8370cd5113df51f0a93d45c74c0da22ef60 100644 (file)
@@ -497,18 +497,18 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
                             if( ty >= 0 )
                             {
                                 vec[0] += tx;
-                                vec[1] += fabs(tx);
+                                vec[1] += (float)fabs(tx);
                             } else {
                                 vec[2] += tx;
-                                vec[3] += fabs(tx);
+                                vec[3] += (float)fabs(tx);
                             }
                             if ( tx >= 0 )
                             {
                                 vec[4] += ty;
-                                vec[5] += fabs(ty);
+                                vec[5] += (float)fabs(ty);
                             } else {
                                 vec[6] += ty;
-                                vec[7] += fabs(ty);
+                                vec[7] += (float)fabs(ty);
                             }
                         }
                     }
@@ -534,7 +534,7 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
                         {
                             float tx = DX[y][x], ty = DY[y][x];
                             vec[0] += tx; vec[1] += ty;
-                            vec[2] += fabs(tx); vec[3] += fabs(ty);
+                            vec[2] += (float)fabs(tx); vec[3] += (float)fabs(ty);
                         }
                     }
                     double normalize = 0;
index 75f85ae60569761dbb5609bd42cd79a8d61c7b7f..9e4d3013eee18963957aaf4c08b0ce9c2a345c34 100644 (file)
@@ -463,15 +463,15 @@ cvSolveCubic( const CvMat* coeffs, CvMat* roots )
 
 #define MAXN 16
 
-template <class T>
-static void icvFindPolynomialRoots(const T *a, T *u, int n, int maxiter, int fig) {
+static void icvFindPolynomialRoots(const double *a, double *u, int n, int maxiter, int fig)
+{
   int i;
   int j;
-  T h[MAXN + 3], b[MAXN + 3], c[MAXN + 3], d[MAXN + 3], e[MAXN + 3];
+  double h[MAXN + 3], b[MAXN + 3], c[MAXN + 3], d[MAXN + 3], e[MAXN + 3];
   // [-2 : n]
-  T K, ps, qs, pt, qt, s, rev, r;
+  double K, ps, qs, pt, qt, s, rev, r = 0;
   int t;
-  T p, q, qq;
+  double p = 0, q = 0, qq;
 
   // Zero elements with negative indices
   b[2 + -1] = b[2 + -2] =
@@ -639,35 +639,49 @@ static void icvFindPolynomialRoots(const T *a, T *u, int n, int maxiter, int fig
 
 #undef MAXN
 
-void cvSolvePoly(const CvMat* a, CvMat *r, int maxiter, int fig) {
-  int m = a->rows * a->cols;
-  int n = r->rows * r->cols;
-
-  __BEGIN__;
-  CV_FUNCNAME("cvSolvePoly");
-
-  if (CV_MAT_TYPE(a->type) != CV_32FC1 && 
-      CV_MAT_TYPE(a->type) != CV_64FC1)
-    CV_ERROR(CV_StsUnsupportedFormat, "coeffs must be either CV_32FC1 or CV_64FC1");
-  if (CV_MAT_TYPE(r->type) != CV_32FC2 && 
-      CV_MAT_TYPE(r->type) != CV_64FC2)
-    CV_ERROR(CV_StsUnsupportedFormat, "roots must be either CV_32FC2 or CV_64FC2");
-  if (CV_MAT_DEPTH(a->type) != CV_MAT_DEPTH(r->type))
-    CV_ERROR(CV_StsUnmatchedFormats, "coeffs and roots must have same depth");
-
-  if (m - 1 != n)
-    CV_ERROR(CV_StsUnmatchedFormats, "must have n + 1 coefficients");
-
-  switch (CV_MAT_DEPTH(a->type)) {
-  case CV_32F:
-    icvFindPolynomialRoots(a->data.fl, r->data.fl, n, maxiter, fig);
-    break;
-  case CV_64F:
-    icvFindPolynomialRoots(a->data.db, r->data.db, n, maxiter, fig);
-    break;
-  }
+void cvSolvePoly(const CvMat* a, CvMat *r, int maxiter, int fig)
+{
+    __BEGIN__;
+
+    int m, n;
+    double *ad = 0, *rd = 0;
+
+    CV_FUNCNAME("cvSolvePoly");
+
+    if (CV_MAT_TYPE(a->type) != CV_32FC1 && 
+        CV_MAT_TYPE(a->type) != CV_64FC1)
+        CV_ERROR(CV_StsUnsupportedFormat, "coeffs must be either CV_32FC1 or CV_64FC1");
+    if (CV_MAT_TYPE(r->type) != CV_32FC2 && 
+        CV_MAT_TYPE(r->type) != CV_64FC2)
+        CV_ERROR(CV_StsUnsupportedFormat, "roots must be either CV_32FC2 or CV_64FC2");
+    m = a->rows * a->cols;
+    n = r->rows * r->cols;
+
+    if (m - 1 != n)
+        CV_ERROR(CV_StsUnmatchedFormats, "must have n + 1 coefficients");
+
+    if( CV_MAT_TYPE(a->type) == CV_32F || !CV_IS_MAT_CONT(a->type))
+    {
+        ad = (double*)cvStackAlloc(m*sizeof(ad[0]));
+        CvMat _a = cvMat( a->rows, a->cols, CV_64F, ad );
+        cvConvert( a, &_a );
+    }
+    else
+        ad = a->data.db;
+
+    if( CV_MAT_TYPE(r->type) == CV_32F || !CV_IS_MAT_CONT(r->type))
+        rd = (double*)cvStackAlloc(n*sizeof(ad[0]));
+    else
+        rd = r->data.db;
 
-  __END__;
+    icvFindPolynomialRoots( ad, rd, n, maxiter, fig);
+    if( rd != r->data.db )
+    {
+        CvMat _r = cvMat( r->rows, r->cols, CV_64F, rd );
+        cvConvert( &_r, r );
+    }
+
+    __END__;
 }