]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed MSVC compile errors and warnings
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Sat, 18 Jul 2009 18:45:08 +0000 (18:45 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Sat, 18 Jul 2009 18:45:08 +0000 (18:45 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@1948 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/include/opencv/cv.hpp
opencv/src/cv/cvstardetector.cpp
opencv/src/cv/cvsurf.cpp
opencv/src/cvaux/cvplanardetect.cpp
opencv/src/cxcore/cxarray.cpp
opencv/src/cxcore/cxmatmul.cpp
opencv/tests/cv/src/cvtest.h

index 301284fcf290ac84bb55248edfe9136669af1075..854c30cc1dc1a03db6c4beaf972f22e786c71cf3 100644 (file)
@@ -854,7 +854,9 @@ public:
     float response;
     int octave;
 };
-    
+
+CV_EXPORTS void write(FileStorage& fs, const String& name, const Vector<Keypoint>& keypoints);
+CV_EXPORTS void read(const FileNode& node, Vector<Keypoint>& keypoints);    
 
 class CV_EXPORTS SURF : public CvSURFParams
 {
@@ -896,10 +898,6 @@ public:
     void operator()(const Mat& image, Vector<Keypoint>& keypoints) const;
 };
     
-    
-void write(FileStorage& fs, const String& name, const Vector<Keypoint>& keypoints);
-void read(const FileNode& node, Vector<Keypoint>& keypoints);    
-
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
index ac97ee8b1a0fd9125e6457e1e835e103f8545000..1fd4be2a542709015a3ee8c5b5d6369f5050c1c9 100644 (file)
@@ -461,7 +461,7 @@ void StarDetector::operator()(const Mat& image, Vector<Keypoint>& keypoints) con
     for( i = 0; i < n; i++, ++it )
     {
         const CvStarKeypoint& kpt = *it;
-        keypoints[i] = Keypoint(kpt.pt, kpt.size, -1.f, kpt.response, 0);
+        keypoints[i] = Keypoint(kpt.pt, (float)kpt.size, -1.f, kpt.response, 0);
     }
 }
 
index d3b30f360d29a3d00662a7cddfed594786817f01..cc66cb2a3436ebfa840ab115d27963343ae6a42f 100644 (file)
@@ -791,7 +791,7 @@ static int getPointOctave(const CvSURFPoint& kpt, const CvSURFParams& params)
     for( octave = 1; octave < params.nOctaves; octave++ )
         for( layer = 0; layer < params.nOctaveLayers; layer++ )
         {
-            float diff = std::abs(kpt.size - ((HAAR_SIZE0 + HAAR_SIZE_INC*layer) << octave));
+            float diff = std::abs(kpt.size - (float)((HAAR_SIZE0 + HAAR_SIZE_INC*layer) << octave));
             if( min_diff > diff )
             {
                 min_diff = diff;
@@ -819,7 +819,8 @@ void SURF::operator()(const Mat& img, const Mat& mask,
     for( i = 0; i < n; i++, ++it )
     {
         const CvSURFPoint& kpt = *it;
-        keypoints[i] = Keypoint(kpt.pt, kpt.size, kpt.dir, kpt.hessian, getPointOctave(kpt, *this));
+        keypoints[i] = Keypoint(kpt.pt, (float)kpt.size, kpt.dir,
+                                kpt.hessian, getPointOctave(kpt, *this));
     }
 }
 
@@ -856,7 +857,8 @@ void SURF::operator()(const Mat& img, const Mat& mask,
         for( i = 0; i < n; i++, ++it )
         {
             const CvSURFPoint& kpt = *it;
-            keypoints[i] = Keypoint(kpt.pt, kpt.size, kpt.dir, kpt.hessian, getPointOctave(kpt, *this));
+            keypoints[i] = Keypoint(kpt.pt, (float)kpt.size, kpt.dir,
+                                    kpt.hessian, getPointOctave(kpt, *this));
         }
     }
     Seq<float>(d).copyTo(descriptors);
index 90b2904260542f761c257779b37478baac132727..6071a72d81de1ee0b4ce86de66513c3f437aae6f 100644 (file)
@@ -197,8 +197,8 @@ void PatchGenerator::warpWholeImage(const Mat& image, Mat& _T, Mat& buf,
         Point2f pt0, pt1;
         pt0.x = (float)(k == 0 || k == 3 ? 0 : image.cols);
         pt0.y = (float)(k < 2 ? 0 : image.rows);
-        pt1.x = T(0,0)*pt0.x + T(0,1)*pt0.y + T(0,2);
-        pt1.y = T(1,0)*pt0.x + T(1,1)*pt0.y + T(1,2);
+        pt1.x = (float)(T(0,0)*pt0.x + T(0,1)*pt0.y + T(0,2));
+        pt1.y = (float)(T(1,0)*pt0.x + T(1,1)*pt0.y + T(1,2));
         
         roi.x = std::min(roi.x, cvFloor(pt1.x));
         roi.y = std::min(roi.y, cvFloor(pt1.y));
@@ -523,7 +523,7 @@ void LDetector::operator()(const Vector<Mat>& pyr, Vector<Keypoint>& keypoints,
                 }
                 else
                 {
-                    scores[x] = computeLResponse(img, cdata, csize);
+                    scores[x] = (short)computeLResponse(img, cdata, csize);
                     mask[x] = 1;
                 }
             }
@@ -551,7 +551,8 @@ void LDetector::operator()(const Vector<Mat>& pyr, Vector<Keypoint>& keypoints,
                     {
                         int val = scores[ndata_s[k]];
                         if( val == 0 && recomputeZeroScores )
-                            scores[ndata_s[k]] = val = computeLResponse(img + ndata[k], cdata, csize);
+                            scores[ndata_s[k]] = (short)(val =
+                                computeLResponse(img + ndata[k], cdata, csize));
                         if( val0 < val )
                             break;
                     }
@@ -562,7 +563,8 @@ void LDetector::operator()(const Vector<Mat>& pyr, Vector<Keypoint>& keypoints,
                     {
                         int val = scores[ndata_s[k]];
                         if( val == 0 && recomputeZeroScores )
-                            scores[ndata_s[k]] = val = computeLResponse(img + ndata[k], cdata, csize);
+                            scores[ndata_s[k]] = (short)(val =
+                                computeLResponse(img + ndata[k], cdata, csize));
                         if( val0 > val )
                             break;
                     }
@@ -573,8 +575,8 @@ void LDetector::operator()(const Vector<Mat>& pyr, Vector<Keypoint>& keypoints,
                 for( int i1 = -1; i1 <= 1; i1++ )
                     for( int j1 = -1; j1 <= 1; j1++ )
                     {
-                        fval[(i1+1)*3 + j1 + 1] = scores[sstep*i1+j1] ? scores[sstep*i1+j1] :
-                        computeLResponse(img + pyrLayer.step*i1 + j1, cdata, csize);
+                        fval[(i1+1)*3 + j1 + 1] = (float)(scores[sstep*i1+j1] ? scores[sstep*i1+j1] :
+                            computeLResponse(img + pyrLayer.step*i1 + j1, cdata, csize));
                     }
                 Point2f pt = adjustCorner(fval, fvaln);
                 pt.x += x;
@@ -896,8 +898,8 @@ void FernClassifier::trainFromSingleView(const Mat& image,
             Point2f pt0, pt1;
             pt0.x = (float)(k == 0 || k == 3 ? 0 : image.cols);
             pt0.y = (float)(k < 2 ? 0 : image.rows);
-            pt1.x = M[0]*pt0.x + M[1]*pt0.y + M[2];
-            pt1.y = M[3]*pt0.x + M[4]*pt0.y + M[5];
+            pt1.x = (float)(M[0]*pt0.x + M[1]*pt0.y + M[2]);
+            pt1.y = (float)(M[3]*pt0.x + M[4]*pt0.y + M[5]);
             
             roi.x = std::min(roi.x, cvFloor(pt1.x));
             roi.y = std::min(roi.y, cvFloor(pt1.y));
@@ -944,8 +946,8 @@ void FernClassifier::trainFromSingleView(const Mat& image,
         {
             Keypoint kpt = keypoints[j];
             float scale = 1.f/(1 << kpt.octave);
-            Point2f pt((M[0]*kpt.pt.x + M[1]*kpt.pt.y + M[2])*scale,
-                       (M[3]*kpt.pt.x + M[4]*kpt.pt.y + M[5])*scale);
+            Point2f pt((float)((M[0]*kpt.pt.x + M[1]*kpt.pt.y + M[2])*scale),
+                       (float)((M[3]*kpt.pt.x + M[4]*kpt.pt.y + M[5])*scale));
             getRectSubPix(pyr[kpt.octave], patchSize, pt, patch, patch.type());
             for( int f = 0; f < nstructs; f++ )
                 posteriors[getLeaf(f, patch)*nclasses + j]++;
@@ -1012,7 +1014,7 @@ int FernClassifier::operator()(const Mat& patch, Vector<float>& signature) const
 }
 
 
-void FernClassifier::finalize(RNG& rng)
+void FernClassifier::finalize(RNG&)
 {
     int i, j, k, n = nclasses;
     Vector<double> invClassCounters(n);
@@ -1323,11 +1325,11 @@ bool PlanarObjectDetector::operator()(const Vector<Mat>& pyr, const Vector<Keypo
         corners.resize(4);
         for( i = 0; i < 4; i++ )
         {
-            Point2f pt(modelROI.x + (i == 0 || i == 3 ? 0 : modelROI.width),
-                       modelROI.y + (i <= 1 ? 0 : modelROI.height));
-            float w = 1./(H(2,0)*pt.x + H(2,1)*pt.y + H(2,2));
-            corners[i] = Point2f((H(0,0)*pt.x + H(0,1)*pt.y + H(0,2))*w,
-                                 (H(1,0)*pt.x + H(1,1)*pt.y + H(1,2))*w);
+            Point2f pt((float)(modelROI.x + (i == 0 || i == 3 ? 0 : modelROI.width)),
+                       (float)(modelROI.y + (i <= 1 ? 0 : modelROI.height)));
+            double w = 1./(H(2,0)*pt.x + H(2,1)*pt.y + H(2,2));
+            corners[i] = Point2f((float)((H(0,0)*pt.x + H(0,1)*pt.y + H(0,2))*w),
+                                 (float)((H(1,0)*pt.x + H(1,1)*pt.y + H(1,2))*w));
         }
     }
     
index 3420b07f11d43c2ce3d670682026003fe74df116..7b3ba4ea759346d069a7f8b5f111e26eb36eb5c0 100644 (file)
@@ -2979,8 +2979,8 @@ cvSetImageROI( IplImage* image, CvRect rect )
     // allow zero ROI width or height
     CV_Assert( rect.width >= 0 && rect.height >= 0 &&
                rect.x < image->width && rect.y < image->height &&
-               rect.x + rect.width >= (rect.width > 0) &&
-               rect.y + rect.height >= (rect.height > 0) );
+               rect.x + rect.width >= (int)(rect.width > 0) &&
+               rect.y + rect.height >= (int)(rect.height > 0) );
     
     rect.width += rect.x;
     rect.height += rect.y;
index 143c7dbdc0c3ce3776df265984a9b30259f58d96..25615e3b0fa7c50000324fda0e227178b2620867 100644 (file)
@@ -1010,14 +1010,13 @@ void gemm( const Mat& _A, const Mat& _B, double alpha,
         blockMulFunc = (GEMMBlockMulFunc)GEMMBlockMul_32fc;
         storeFunc = (GEMMStoreFunc)GEMMStore_32fc;
     }
-    else if( type == CV_64FC2 )
+    else
     {
+        CV_Assert( type == CV_64FC2 );
         singleMulFunc = (GEMMSingleMulFunc)GEMMSingleMul_64fc;
         blockMulFunc = (GEMMBlockMulFunc)GEMMBlockMul_64fc;
         storeFunc = (GEMMStoreFunc)GEMMStore_64fc;
     }
-    else
-        CV_Error( CV_StsUnsupportedFormat, "" );
 
     if( D.data == A.data || D.data == B.data )
     {
index 0b70f557bd482b522197f2f3fb75b8a06a65bde9..4880ded318c5b2e243996d7820d883b8e6081801 100644 (file)
@@ -52,6 +52,9 @@
 #include "cxts.h"
 #include "highgui.h"
 
+#undef min
+#undef max
+
 void cvTsCalcSobelKernel2D( int dx, int dy, int _aperture_size, int origin, CvMat* kernel );
 int cvTsRodrigues( const CvMat* src, CvMat* dst, CvMat* jacobian=0 );
 void cvTsConvertHomogeneous( const CvMat* src, CvMat* dst );