Merged the trunk r8324:8345
authorAndrey Kamaev <no@email>
Fri, 18 May 2012 12:59:40 +0000 (12:59 +0000)
committerAndrey Kamaev <no@email>
Fri, 18 May 2012 12:59:40 +0000 (12:59 +0000)
CMakeLists.txt
cmake/OpenCVDetectPython.cmake
cmake/OpenCVModule.cmake
modules/core/perf/perf_convertTo.cpp
modules/core/src/matmul.cpp
modules/ml/include/opencv2/ml/ml.hpp
modules/ts/CMakeLists.txt
modules/video/include/opencv2/video/video.hpp
samples/gpu/performance/performance.cpp

index 8b98ba1..6999ecb 100644 (file)
@@ -154,10 +154,19 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES  "Install Python examples"   OFF )
 OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples"  OFF  IF ANDROID )
 OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT IOS AND BUILD_SHARED_LIBS) )
 
+
+if(CMAKE_GENERATOR MATCHES Xcode)
+    set(ENABLE_SOLUTION_FOLDERS0 ON)
+elseif(MSVC_IDE)
+    set(ENABLE_SOLUTION_FOLDERS0 ON)
+else()
+    set(ENABLE_SOLUTION_FOLDERS0 OFF)
+endif()    
+
 # OpenCV build options
 # ===================================================
 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers"                                  ON   IF (NOT IOS) )
-OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        MSVC_IDE IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
+OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        ${ENABLE_SOLUTION_FOLDERS0} IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
 OCV_OPTION(ENABLE_PROFILING           "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF  IF CMAKE_COMPILER_IS_GNUCXX )
 OCV_OPTION(ENABLE_OMIT_FRAME_POINTER  "Enable -fomit-frame-pointer for GCC"                      ON   IF CMAKE_COMPILER_IS_GNUCXX )
 OCV_OPTION(ENABLE_POWERPC             "Enable PowerPC for GCC"                                   ON   IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
index 9b8b826..e025a7f 100644 (file)
@@ -20,8 +20,8 @@ unset(HAVE_SPHINX CACHE)
 
 if(PYTHON_EXECUTABLE)
   if(PYTHON_VERSION_STRING)
-    set(PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
     set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+    string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
   else()
     execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
       ERROR_VARIABLE PYTHON_VERSION_FULL
index 9c21c73..8d37ffe 100644 (file)
@@ -7,6 +7,7 @@
 #
 # OPENCV_MODULE_${the_module}_LOCATION
 # OPENCV_MODULE_${the_module}_DESCRIPTION
+# OPENCV_MODULE_${the_module}_CLASS - PUBLIC|INTERNAL|BINDINGS
 # OPENCV_MODULE_${the_module}_HEADERS
 # OPENCV_MODULE_${the_module}_SOURCES
 # OPENCV_MODULE_${the_module}_DEPS - final flattened set of module dependencies
@@ -18,6 +19,8 @@
 # To control the setup of the module you could also set:
 # the_description - text to be used as current module description
 # OPENCV_MODULE_TYPE - STATIC|SHARED - set to force override global settings for current module
+# OPENCV_MODULE_IS_PART_OF_WORLD - ON|OFF (default ON) - should the module be added to the opencv_world?
+# BUILD_${the_module}_INIT - ON|OFF (default ON) - initial value for BUILD_${the_module}
 
 # The verbose template for OpenCV module:
 #
 
 # clean flags for modules enabled on previous cmake run
 # this is necessary to correctly handle modules removal
-foreach(mod ${OPENCV_MODULES_BUILD})
+foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
   if(HAVE_${mod})
     unset(HAVE_${mod} CACHE)
   endif()
+  unset(OPENCV_MODULE_${mod}_REQ_DEPS CACHE)
+  unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE)
 endforeach()
 
 # clean modules info which needs to be recalculated
@@ -58,8 +63,8 @@ set(OPENCV_MODULES_DISABLED_FORCE "" CACHE INTERNAL "List of OpenCV modules whic
 # * <list of dependencies> - can include full names of modules or full pathes to shared/static libraries or cmake targets
 macro(ocv_add_dependencies full_modname)
   #we don't clean the dependencies here to allow this macro several times for every module
-  foreach(d "REQIRED" ${ARGN})
-    if(d STREQUAL "REQIRED")
+  foreach(d "REQUIRED" ${ARGN})
+    if(d STREQUAL "REQUIRED")
       set(__depsvar OPENCV_MODULE_${full_modname}_REQ_DEPS)
     elseif(d STREQUAL "OPTIONAL")
       set(__depsvar OPENCV_MODULE_${full_modname}_OPT_DEPS)
@@ -84,7 +89,7 @@ endmacro()
 # Usage:
 #   ocv_add_module(<name> [INTERNAL|BINDINGS] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
 # Example:
-#   ocv_add_module(yaom INTERNAL opencv_core opencv_highgui NOLINK opencv_flann OPTIONAL opencv_gpu)
+#   ocv_add_module(yaom INTERNAL opencv_core opencv_highgui opencv_flann OPTIONAL opencv_gpu)
 macro(ocv_add_module _name)
   string(TOLOWER "${_name}" name)
   string(REGEX REPLACE "^opencv_" "" ${name} "${name}")
@@ -106,23 +111,31 @@ macro(ocv_add_module _name)
     endif()
     set(OPENCV_MODULE_${the_module}_DESCRIPTION "${the_description}" CACHE INTERNAL "Brief description of ${the_module} module")
     set(OPENCV_MODULE_${the_module}_LOCATION    "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${the_module} module sources")
-    unset(OPENCV_MODULE_${the_module}_REQ_DEPS CACHE)
-    unset(OPENCV_MODULE_${the_module}_OPT_DEPS CACHE)
 
     #create option to enable/disable this module
-    option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ON)
+    if(NOT DEFINED BUILD_${the_module}_INIT)
+      set(BUILD_${the_module}_INIT ON)
+    endif()
+    option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ${BUILD_${the_module}_INIT})
 
     if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
+      set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module")
       set(__ocv_argn__ ${ARGN})
       list(REMOVE_AT __ocv_argn__ 0)
       ocv_add_dependencies(${the_module} ${__ocv_argn__})
       unset(__ocv_argn__)
     else()
+      set(OPENCV_MODULE_${the_module}_CLASS "PUBLIC" CACHE INTERNAL "The cathegory of the module")
       ocv_add_dependencies(${the_module} ${ARGN})
       if(BUILD_${the_module})
         set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} "${the_module}" CACHE INTERNAL "List of OpenCV modules marked for export")
       endif()
     endif()
+    
+    # add self to the world dependencies
+    if(NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD AND NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "BINDINGS" OR OPENCV_MODULE_IS_PART_OF_WORLD)
+      ocv_add_dependencies(opencv_world OPTIONAL ${the_module})
+    endif()
 
     if(BUILD_${the_module})
       set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD} "${the_module}" CACHE INTERNAL "List of OpenCV modules included into the build")
@@ -429,10 +442,13 @@ endmacro()
 # creates OpenCV module in current folder
 # creates new target, configures standard dependencies, compilers flags, install rules
 # Usage:
-# ocv_create_module(<extra link dependencies>)
+#   ocv_create_module(<extra link dependencies>)
+#   ocv_create_module(SKIP_LINK)
 macro(ocv_create_module)
   add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES})
-  target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
+  if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
+    target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
+  endif()
   add_dependencies(opencv_modules ${the_module})
 
   if(ENABLE_SOLUTION_FOLDERS)
index ef0bf65..7ba9d36 100644 (file)
@@ -32,5 +32,5 @@ PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo,
 \r
     TEST_CYCLE() src.convertTo(dst, depthDst, alpha);\r
 \r
-    SANITY_CHECK(dst, 1e-12);\r
+    SANITY_CHECK(dst, alpha == 1.0 ? 1e-12 : 1e-7);\r
 }\r
index dbfa36e..a55fab3 100644 (file)
@@ -2768,8 +2768,9 @@ typedef double (*DotProdFunc)(const uchar* src1, const uchar* src2, int len);
 
 static DotProdFunc dotProdTab[] =
 {
-    (DotProdFunc)GET_OPTIMIZED(dotProd_8u), (DotProdFunc)dotProd_8s, (DotProdFunc)dotProd_16u,
-    (DotProdFunc)dotProd_16s, (DotProdFunc)dotProd_32s, (DotProdFunc)GET_OPTIMIZED(dotProd_32f),
+    (DotProdFunc)GET_OPTIMIZED(dotProd_8u), (DotProdFunc)GET_OPTIMIZED(dotProd_8s),
+    (DotProdFunc)dotProd_16u, (DotProdFunc)dotProd_16s,
+    (DotProdFunc)dotProd_32s, (DotProdFunc)GET_OPTIMIZED(dotProd_32f),
     (DotProdFunc)dotProd_64f, 0
 };
 
index 0cc1b5f..6358fa7 100644 (file)
@@ -2136,6 +2136,8 @@ typedef CvGBTreesParams GradientBoostingTreeParams;
 typedef CvGBTrees GradientBoostingTrees;
 
 template<> CV_EXPORTS void Ptr<CvDTreeSplit>::delete_obj();
+
+CV_EXPORTS bool initModule_ml(void);
     
 }
 
index b623750..ba4847b 100644 (file)
@@ -1,3 +1,5 @@
+set(the_description "The ts module")
+
 if(IOS)
   ocv_module_disable(ts)
 endif()
@@ -5,8 +7,9 @@ endif()
 if(MINGW)
   set(OPENCV_MODULE_TYPE STATIC)
 endif()
-    
-set(the_description "The ts module")
+
+set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
+   
 ocv_add_module(ts opencv_core)
 ocv_glob_module_sources()
 ocv_module_include_directories()
index 21a2fce..ebac290 100644 (file)
 #include "opencv2/video/tracking.hpp"
 #include "opencv2/video/background_segm.hpp"
 
+#ifdef __cplusplus
+namespace cv
+{
+
+CV_EXPORTS bool initModule_video(void);
+    
+}
+#endif
+
 #endif //__OPENCV_VIDEO_HPP__
index e268d65..b9c1939 100644 (file)
@@ -17,7 +17,7 @@ void TestSystem::run()
         return;\r
     }\r
 \r
-    // Run test initializers    \r
+    // Run test initializers\r
     for (vector<Runnable*>::iterator it = inits_.begin(); it != inits_.end(); ++it)\r
     {\r
         if ((*it)->name().find(test_filter_, 0) != string::npos)\r
@@ -67,7 +67,7 @@ void TestSystem::finishCurrentSubtest()
     speedup_total_ += speedup;\r
 \r
     printMetrics(cpu_time, gpu_time, speedup);\r
-    \r
+\r
     num_subtests_called_++;\r
     resetCurrentSubtest();\r
 }\r
@@ -86,8 +86,8 @@ void TestSystem::printHeading()
 {\r
     cout << endl;\r
     cout << setiosflags(ios_base::left);\r
-    cout << TAB << setw(10) << "CPU, ms" << setw(10) << "GPU, ms" \r
-        << setw(14) << "SPEEDUP" \r
+    cout << TAB << setw(10) << "CPU, ms" << setw(10) << "GPU, ms"\r
+        << setw(14) << "SPEEDUP"\r
         << "DESCRIPTION\n";\r
     cout << resetiosflags(ios_base::left);\r
 }\r
@@ -96,8 +96,8 @@ void TestSystem::printHeading()
 void TestSystem::printSummary()\r
 {\r
     cout << setiosflags(ios_base::fixed);\r
-    cout << "\naverage GPU speedup: x" \r
-        << setprecision(3) << speedup_total_ / std::max(1, num_subtests_called_) \r
+    cout << "\naverage GPU speedup: x"\r
+        << setprecision(3) << speedup_total_ / std::max(1, num_subtests_called_)\r
         << endl;\r
     cout << resetiosflags(ios_base::fixed);\r
 }\r
@@ -144,7 +144,7 @@ string abspath(const string& relpath)
 }\r
 \r
 \r
-int CV_CDECL cvErrorCallback(int /*status*/, const char* /*func_name*/, \r
+int CV_CDECL cvErrorCallback(int /*status*/, const char* /*func_name*/,\r
                              const char* err_msg, const char* /*file_name*/,\r
                              int /*line*/, void* /*userdata*/)\r
 {\r
@@ -217,6 +217,8 @@ int main(int argc, const char* argv[])
 \r
     TestSystem::instance().setNumIters(iters);\r
 \r
+    cout << "\nNote: the timings for GPU don't include data transfer" << endl;\r
+\r
     TestSystem::instance().run();\r
 \r
     return 0;\r