Reenabled OpponentSIFT test;
authorAndrey Kamaev <no@email>
Thu, 26 Apr 2012 21:37:27 +0000 (21:37 +0000)
committerAndrey Kamaev <no@email>
Thu, 26 Apr 2012 21:37:27 +0000 (21:37 +0000)
Changed compiler flags for 32-bit MSVC;
Fixed handling of "d" suffix of debug binaries in run.py.

cmake/OpenCVCompilerOptions.cmake
modules/core/test/test_arithm.cpp
modules/nonfree/test/test_features2d.cpp
modules/ts/misc/run.py

index abaae56..8f13fa6 100644 (file)
@@ -17,27 +17,6 @@ set(OPENCV_EXTRA_EXE_LINKER_FLAGS "")
 set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "")
 set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "")
 
-if(MSVC)
-  set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
-  # 64-bit portability warnings, in MSVC80
-  if(MSVC80)
-    set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Wp64")
-  endif()
-
-  if(BUILD_WITH_DEBUG_INFO)
-    set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
-  endif()
-
-  # Remove unreferenced functions: function level linking
-  set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Gy")
-  if(NOT MSVC_VERSION LESS 1400)
-    set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /bigobj")
-  endif()
-  if(BUILD_WITH_DEBUG_INFO)
-    set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /Zi")
-  endif()
-endif()
-
 if(CMAKE_COMPILER_IS_GNUCXX)
   # High level of warnings.
   set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -Wall")
@@ -138,8 +117,27 @@ if(CMAKE_COMPILER_IS_GNUCXX)
 endif()
 
 if(MSVC)
-  # 64-bit MSVC compiler uses SSE/SSE2 by default
+  set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS")
+  # 64-bit portability warnings, in MSVC80
+  if(MSVC80)
+    set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Wp64")
+  endif()
+
+  if(BUILD_WITH_DEBUG_INFO)
+    set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
+  endif()
+
+  # Remove unreferenced functions: function level linking
+  set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Gy")
+  if(NOT MSVC_VERSION LESS 1400)
+    set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /bigobj")
+  endif()
+  if(BUILD_WITH_DEBUG_INFO)
+    set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /Zi")
+  endif()
+
   if(NOT MSVC64)
+    # 64-bit MSVC compiler uses SSE/SSE2 by default
     if(ENABLE_SSE)
       set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE")
     endif()
@@ -147,15 +145,23 @@ if(MSVC)
       set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE2")
     endif()
   endif()
+  
   if(ENABLE_SSE3)
     set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE3")
   endif()
   if(ENABLE_SSE4_1)
     set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE4.1")
   endif()
+  
   if(ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1)
     set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Oi")
   endif()
+  
+  if(X86 OR X86_64)
+    if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND ENABLE_SSE2)
+      set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /fp:fast")# !! important - be on the same wave with x64 compilers
+    endif()
+  endif()
 endif()
 
 # Extra link libs if the user selects building static libs:
index 7faa919..bb61405 100644 (file)
@@ -1186,8 +1186,12 @@ struct CountNonZeroOp : public BaseElemWiseOp
     
 struct MeanStdDevOp : public BaseElemWiseOp
 {
+    Scalar sqmeanRef;
+    int cn;
+
     MeanStdDevOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK+SCALAR_OUTPUT, 1, 1, Scalar::all(0))
     {
+        cn = 0;
         context = 7;
     };
     void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
@@ -1202,6 +1206,9 @@ struct MeanStdDevOp : public BaseElemWiseOp
         cvtest::multiply(temp, temp, temp);
         Scalar mean = cvtest::mean(src[0], mask);
         Scalar sqmean = cvtest::mean(temp, mask);
+        
+        sqmeanRef = sqmean;
+        cn = temp.channels();
 
         for( int c = 0; c < 4; c++ )
             sqmean[c] = std::sqrt(std::max(sqmean[c] - mean[c]*mean[c], 0.)); 
@@ -1212,7 +1219,11 @@ struct MeanStdDevOp : public BaseElemWiseOp
     }
     double getMaxErr(int)
     {
-        return 1e-6;
+        CV_Assert(cn > 0);
+        double err = sqmeanRef[0];
+        for(int i = 1; i < cn; ++i)
+            err = std::max(err, sqmeanRef[i]);
+        return 3e-7 * err;
     }
 };    
 
index 54d12d3..d6f5cf6 100644 (file)
@@ -302,6 +302,8 @@ protected:
         if( validDescriptors.size != calcDescriptors.size || validDescriptors.type() != calcDescriptors.type() )
         {
             ts->printf(cvtest::TS::LOG, "Valid and computed descriptors matrices must have the same size and type.\n");
+            ts->printf(cvtest::TS::LOG, "Valid size is (%d x %d) actual size is (%d x %d).\n", validDescriptors.rows, validDescriptors.cols, calcDescriptors.rows, calcDescriptors.cols);
+            ts->printf(cvtest::TS::LOG, "Valid type is %d  actual type is %d.\n", validDescriptors.type(), calcDescriptors.type());
             ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
             return;
         }
@@ -997,12 +999,12 @@ TEST( Features2d_DescriptorExtractor_SURF, regression )
     test.safe_run();
 }
 
-/*TEST( Features2d_DescriptorExtractor_OpponentSIFT, regression )
+TEST( Features2d_DescriptorExtractor_OpponentSIFT, regression )
 {
     CV_DescriptorExtractorTest<L2<float> > test( "descriptor-opponent-sift", 0.18f,
                                                  DescriptorExtractor::create("OpponentSIFT"), 8.06652f  );
     test.safe_run();
-}*/
+}
 
 TEST( Features2d_DescriptorExtractor_OpponentSURF, regression )
 {
index 2bcc085..516b5eb 100644 (file)
@@ -397,7 +397,10 @@ class RunInfo(object):
     def getLogName(self, app, timestamp):
         app = os.path.basename(app)
         if app.endswith(".exe"):
-            app = app[:-4]
+            if app.endswith("d.exe"):
+                app = app[:-5]
+            else:
+                app = app[:-4]
         if app.startswith(self.nameprefix):
             app = app[len(self.nameprefix):]
 
@@ -531,7 +534,10 @@ class RunInfo(object):
             if fname == name:
                 return t
             if fname.endswith(".exe") or (self.targetos == "android" and fname.endswith(".apk")):
-                fname = fname[:-4]
+                if fname.endswith("d.exe"):
+                    fname = fname[:-5]
+                else:
+                    fname = fname[:-4]
             if fname == name:
                 return t
             if fname.startswith(self.nameprefix):
@@ -747,7 +753,7 @@ if __name__ == "__main__":
     parser.add_option("-a", "--accuracy", dest="accuracy", help="look for accuracy tests instead of performance tests", action="store_true", default=False)
     parser.add_option("-l", "--longname", dest="useLongNames", action="store_true", help="generate log files with long names", default=False)
     parser.add_option("", "--android_test_data_path", dest="test_data_path", help="OPENCV_TEST_DATA_PATH for Android run", metavar="PATH", default="/sdcard/opencv_testdata/")
-    parser.add_option("", "--configuration", dest="configuration", help="force Debug or Release donfiguration", metavar="CFG", default="")
+    parser.add_option("", "--configuration", dest="configuration", help="force Debug or Release configuration", metavar="CFG", default="")
     parser.add_option("", "--serial", dest="adb_serial", help="Android: directs command to the USB device or emulator with the given serial number", metavar="serial number", default="")
     parser.add_option("", "--package", dest="junit_package", help="Android: run jUnit tests for specified package", metavar="package", default="")
     parser.add_option("", "--help-tests", dest="help", help="Show help for test executable", action="store_true", default=False)