Commit 6cca6a45 authored by Marina Kolpakova's avatar Marina Kolpakova

merged the trunk r8669:8702

parent 150aeee5
...@@ -114,6 +114,7 @@ add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required ...@@ -114,6 +114,7 @@ add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required
if(tbb_need_GENERIC_DWORD_LOAD_STORE) if(tbb_need_GENERIC_DWORD_LOAD_STORE)
#needed by TBB 4.0 update 1,2; fixed in TBB 4.0 update 3 but it has 2 new problems #needed by TBB 4.0 update 1,2; fixed in TBB 4.0 update 3 but it has 2 new problems
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1) add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
set(tbb_need_GENERIC_DWORD_LOAD_STORE ON PARENT_SCOPE)
endif() endif()
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}") add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
......
# ===================================================================================
# The OpenCV CMake configuration file
#
# ** File generated automatically, do not modify **
#
# Usage from an external project:
# In your CMakeLists.txt, add these lines:
#
# FIND_PACKAGE(OpenCV REQUIRED)
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
#
# Or you can search for specific OpenCV modules:
#
# FIND_PACKAGE(OpenCV REQUIRED core highgui)
#
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
#
# This file will define the following variables:
# - OpenCV_LIBS : The list of libraries to links against.
# - OpenCV_LIB_DIR : The directory(es) where lib files are. Calling LINK_DIRECTORIES
# with this path is NOT needed.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
# - OpenCV_VERSION : The version of this OpenCV build. Example: "2.4.0"
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "2"
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "4"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
#
# Advanced variables:
# - OpenCV_SHARED
# - OpenCV_CONFIG_PATH
# - OpenCV_INSTALL_PATH (not set on Windows)
# - OpenCV_LIB_COMPONENTS
# - OpenCV_USE_MANGLED_PATHS
# - OpenCV_HAVE_ANDROID_CAMERA
#
# ===================================================================================
#
# Windows pack specific options:
# - OpenCV_STATIC
# - OpenCV_CUDA
if(NOT DEFINED OpenCV_STATIC)
# look for global setting
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
set(OpenCV_STATIC OFF)
else()
set(OpenCV_STATIC ON)
endif()
endif()
if(NOT DEFINED OpenCV_CUDA)
# if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries
if(CUDA_FOUND)
set(OpenCV_CUDA ON)
endif()
endif()
if(MSVC)
if(CMAKE_CL_64)
set(OpenCV_ARCH x64)
set(OpenCV_TBB_ARCH intel64)
else()
set(OpenCV_ARCH x86)
set(OpenCV_TBB_ARCH ia32)
endif()
if(MSVC_VERSION EQUAL 1400)
set(OpenCV_RUNTIME vc8)
elseif(MSVC_VERSION EQUAL 1500)
set(OpenCV_RUNTIME vc9)
elseif(MSVC_VERSION EQUAL 1600)
set(OpenCV_RUNTIME vc10)
elseif(MSVC_VERSION EQUAL 1700)
set(OpenCV_RUNTIME vc11)
endif()
elseif(MINGW)
set(OpenCV_RUNTIME mingw)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
set(MINGW64 1)
set(OpenCV_ARCH x64)
else()
set(OpenCV_ARCH x86)
endif()
endif()
if(CMAKE_VERSION VERSION_GREATER 2.6.2)
unset(OpenCV_CONFIG_PATH CACHE)
endif()
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
if(OpenCV_RUNTIME AND OpenCV_ARCH)
if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
else()
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
endif()
elseif(EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake")
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
else()
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib")
endif()
endif()
endif()
if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release OpenCV libraries are located" FORCE)
set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug OpenCV libraries are located" FORCE)
set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release 3rdpaty OpenCV dependencies are located" FORCE)
set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug 3rdpaty OpenCV dependencies are located" FORCE)
include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
if(OpenCV_CUDA)
set(_OpenCV_LIBS "")
foreach(_lib ${OpenCV_LIBS})
string(REPLACE "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}" "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}" _lib2 "${_lib}")
if(NOT EXISTS "${_lib}" AND EXISTS "${_lib2}")
list(APPEND _OpenCV_LIBS "${_lib2}")
else()
list(APPEND _OpenCV_LIBS "${_lib}")
endif()
endforeach()
set(OpenCV_LIBS ${_OpenCV_LIBS})
endif()
set(OpenCV_FOUND TRUE CACHE BOOL "" FORCE)
set(OPENCV_FOUND TRUE CACHE BOOL "" FORCE)
if(NOT OpenCV_FIND_QUIETLY)
message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}")
if(NOT OpenCV_LIB_PATH MATCHES "/staticlib")
get_filename_component(_OpenCV_LIB_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE)
file(TO_NATIVE_PATH "${_OpenCV_LIB_PATH}" _OpenCV_LIB_PATH)
message(STATUS "You might need to add ${_OpenCV_LIB_PATH} to your PATH to be able to run your applications.")
if(OpenCV_LIB_PATH MATCHES "/gpu/")
string(REPLACE "\\gpu" "" _OpenCV_LIB_PATH2 "${_OpenCV_LIB_PATH}")
message(STATUS "GPU support is enabled so you might also need ${_OpenCV_LIB_PATH2} in your PATH (it must go after the ${_OpenCV_LIB_PATH}).")
endif()
endif()
endif()
else()
if(NOT OpenCV_FIND_QUIETLY)
message(WARNING "Found OpenCV 2.4.0 Windows Super Pack but it has not binaries compatible with your configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.")
endif()
set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE)
set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE)
endif()
...@@ -2,7 +2,10 @@ if(ANDROID) ...@@ -2,7 +2,10 @@ if(ANDROID)
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb") add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
include_directories(SYSTEM ${TBB_INCLUDE_DIRS}) include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1 -D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1) add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
endif()
set(HAVE_TBB 1) set(HAVE_TBB 1)
elseif(UNIX AND NOT APPLE) elseif(UNIX AND NOT APPLE)
PKG_CHECK_MODULES(TBB tbb) PKG_CHECK_MODULES(TBB tbb)
......
This diff is collapsed.
# taken from http://www.vtk.org/Bug/view.php?id=1260 and slightly adjusted # taken from http://public.kitware.com/Bug/view.php?id=1260 and slightly adjusted
# - Try to find precompiled headers support for GCC 3.4 and 4.x # - Try to find precompiled headers support for GCC 3.4 and 4.x
# Once done this will define: # Once done this will define:
...@@ -26,8 +26,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX) ...@@ -26,8 +26,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
SET(_PCH_include_prefix "-I") SET(_PCH_include_prefix "-I")
SET(_PCH_isystem_prefix "-isystem") SET(_PCH_isystem_prefix "-isystem")
ELSEIF(WIN32) ELSEIF(CMAKE_GENERATOR MATCHES "^Visual.*$")
SET(PCHSupport_FOUND TRUE) # for experimental msvc support SET(PCHSupport_FOUND TRUE)
SET(_PCH_include_prefix "/I") SET(_PCH_include_prefix "/I")
SET(_PCH_isystem_prefix "/I") SET(_PCH_isystem_prefix "/I")
ELSE() ELSE()
...@@ -324,3 +324,17 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input) ...@@ -324,3 +324,17 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
endif() endif()
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
macro(ocv_add_precompiled_header_to_target the_target pch_header)
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}")
if(CMAKE_GENERATOR MATCHES Visual)
string(REGEX REPLACE "hpp$" "cpp" ${the_target}_pch "${pch_header}")
add_native_precompiled_header(${the_target} ${pch_header})
unset(${the_target}_pch)
elseif(CMAKE_GENERATOR MATCHES Xcode)
add_native_precompiled_header(${the_target} ${pch_header})
elseif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
add_precompiled_header(${the_target} ${pch_header})
endif()
endif()
endmacro()
...@@ -384,6 +384,17 @@ macro(ocv_list_add_suffix LST SUFFIX) ...@@ -384,6 +384,17 @@ macro(ocv_list_add_suffix LST SUFFIX)
endmacro() endmacro()
# gets and removes the first element from list
macro(ocv_list_pop_front LST VAR)
if(${LST})
list(GET ${LST} 0 ${VAR})
list(REMOVE_AT ${LST} 0)
else()
set(${VAR} "")
endif()
endmacro()
# simple regex escaping routine (does not cover all cases!!!) # simple regex escaping routine (does not cover all cases!!!)
macro(ocv_regex_escape var regex) macro(ocv_regex_escape var regex)
string(REGEX REPLACE "([+.*^$])" "\\\\1" ${var} "${regex}") string(REGEX REPLACE "([+.*^$])" "\\\\1" ${var} "${regex}")
...@@ -401,7 +412,7 @@ endmacro() ...@@ -401,7 +412,7 @@ endmacro()
# convert list of paths to full paths # convert list of paths to full paths
macro(ocv_to_full_paths VAR) macro(ocv_convert_to_full_paths VAR)
if(${VAR}) if(${VAR})
set(__tmp "") set(__tmp "")
foreach(path ${${VAR}}) foreach(path ${${VAR}})
......
...@@ -102,7 +102,7 @@ You need the following tools to be installed: ...@@ -102,7 +102,7 @@ You need the following tools to be installed:
#. **Eclipse IDE** #. **Eclipse IDE**
Check the `Android SDK System Requirements <http://developer.android.com/sdk/requirements.html>`_ document for a list of Eclipse versions that are compatible with the Android SDK. Check the `Android SDK System Requirements <http://developer.android.com/sdk/requirements.html>`_ document for a list of Eclipse versions that are compatible with the Android SDK.
For OpenCV 2.4.0 we recommend Eclipse 3.7 (Indigo) or later versions. They work well for OpenCV under both Windows and Linux. For OpenCV 2.4.x we recommend Eclipse 3.7 (Indigo) or later versions. They work well for OpenCV under both Windows and Linux.
If you have no Eclipse installed, you can get it from the `download page <http://www.eclipse.org/downloads/>`_. If you have no Eclipse installed, you can get it from the `download page <http://www.eclipse.org/downloads/>`_.
...@@ -154,12 +154,12 @@ Get the OpenCV package for Android development ...@@ -154,12 +154,12 @@ Get the OpenCV package for Android development
.. code-block:: bash .. code-block:: bash
tar -jxvf ~/Downloads/OpenCV-2.4.0-android-bin.tar.bz2 tar -jxvf ~/Downloads/OpenCV-2.4.1-android-bin2.tar.bz2
For this tutorial I have unpacked OpenCV to the :file:`C:\\Work\\android-opencv\\` directory. For this tutorial I have unpacked OpenCV to the :file:`C:\\Work\\android-opencv\\` directory.
.. |opencv_android_bin_pack| replace:: OpenCV-2.4.0-android-bin.tar.bz2 .. |opencv_android_bin_pack| replace:: OpenCV-2.4.1-android-bin2.tar.bz2
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.0/OpenCV-2.4.0-android-bin.tar.bz2/download .. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.1/OpenCV-2.4.1-android-bin2.tar.bz2/download
.. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack| .. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
.. |seven_zip| replace:: 7-Zip .. |seven_zip| replace:: 7-Zip
.. _seven_zip: http://www.7-zip.org/ .. _seven_zip: http://www.7-zip.org/
......
...@@ -48,10 +48,12 @@ ...@@ -48,10 +48,12 @@
#include <iostream> #include <iostream>
#if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 3 #if defined(HAVE_EIGEN) && EIGEN_WORLD_VERSION == 3
#include <Eigen/Core> # include <Eigen/Core>
#include <unsupported/Eigen/MatrixFunctions> # ifdef ANDROID
template <typename Scalar> Scalar log2(Scalar v) { using std::log; return log(v)/log(Scalar(2)); }
#include <Eigen/Dense> # endif
# include <unsupported/Eigen/MatrixFunctions>
# include <Eigen/Dense>
#endif #endif
#include <limits> #include <limits>
...@@ -581,7 +583,7 @@ bool cv::RGBDOdometry( cv::Mat& Rt, const Mat& initRt, ...@@ -581,7 +583,7 @@ bool cv::RGBDOdometry( cv::Mat& Rt, const Mat& initRt,
const double fy = levelCameraMatrix.at<double>(1,1); const double fy = levelCameraMatrix.at<double>(1,1);
const double determinantThreshold = 1e-6; const double determinantThreshold = 1e-6;
Mat corresps( levelImage0.size(), levelImage0.type(), CV_32SC1 ); Mat corresps( levelImage0.size(), levelImage0.type() );
// Run transformation search on current level iteratively. // Run transformation search on current level iteratively.
for( int iter = 0; iter < (*iterCountsPtr)[level]; iter ++ ) for( int iter = 0; iter < (*iterCountsPtr)[level]; iter ++ )
......
...@@ -85,7 +85,6 @@ template<typename _Tp, int cn> class CV_EXPORTS Vec; ...@@ -85,7 +85,6 @@ template<typename _Tp, int cn> class CV_EXPORTS Vec;
template<typename _Tp, int m, int n> class CV_EXPORTS Matx; template<typename _Tp, int m, int n> class CV_EXPORTS Matx;
typedef std::string String; typedef std::string String;
typedef std::basic_string<wchar_t> WString;
class Mat; class Mat;
class SparseMat; class SparseMat;
...@@ -110,8 +109,12 @@ template<typename _Tp> class CV_EXPORTS MatIterator_; ...@@ -110,8 +109,12 @@ template<typename _Tp> class CV_EXPORTS MatIterator_;
template<typename _Tp> class CV_EXPORTS MatConstIterator_; template<typename _Tp> class CV_EXPORTS MatConstIterator_;
template<typename _Tp> class CV_EXPORTS MatCommaInitializer_; template<typename _Tp> class CV_EXPORTS MatCommaInitializer_;
#if !defined(ANDROID) || (defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_WCHAR_T)
typedef std::basic_string<wchar_t> WString;
CV_EXPORTS string fromUtf16(const WString& str); CV_EXPORTS string fromUtf16(const WString& str);
CV_EXPORTS WString toUtf16(const string& str); CV_EXPORTS WString toUtf16(const string& str);
#endif
CV_EXPORTS string format( const char* fmt, ... ); CV_EXPORTS string format( const char* fmt, ... );
CV_EXPORTS string tempfile( const char* suffix CV_DEFAULT(0)); CV_EXPORTS string tempfile( const char* suffix CV_DEFAULT(0));
......
...@@ -151,7 +151,7 @@ cv::string cv::FileStorage::getDefaultObjectName(const string& _filename) ...@@ -151,7 +151,7 @@ cv::string cv::FileStorage::getDefaultObjectName(const string& _filename)
namespace cv namespace cv
{ {
#if !defined(ANDROID) || defined(_GLIBCXX_USE_WCHAR_T) #if !defined(ANDROID) || (defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_WCHAR_T)
string fromUtf16(const WString& str) string fromUtf16(const WString& str)
{ {
cv::AutoBuffer<char> _buf(str.size()*4 + 1); cv::AutoBuffer<char> _buf(str.size()*4 + 1);
......
This diff is collapsed.
...@@ -1005,11 +1005,11 @@ void cv::gpu::BruteForceMatcher_GPU_base::radiusMatchConvert(const Mat& trainIdx ...@@ -1005,11 +1005,11 @@ void cv::gpu::BruteForceMatcher_GPU_base::radiusMatchConvert(const Mat& trainIdx
for (int i = 0; i < nMatches; ++i, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr) for (int i = 0; i < nMatches; ++i, ++trainIdx_ptr, ++imgIdx_ptr, ++distance_ptr)
{ {
int trainIdx = *trainIdx_ptr; int _trainIdx = *trainIdx_ptr;
int imgIdx = *imgIdx_ptr; int _imgIdx = *imgIdx_ptr;
float distance = *distance_ptr; float _distance = *distance_ptr;
DMatch m(queryIdx, trainIdx, imgIdx, distance); DMatch m(queryIdx, _trainIdx, _imgIdx, _distance);
curMatches.push_back(m); curMatches.push_back(m);
} }
......
...@@ -98,17 +98,17 @@ namespace cv { namespace gpu { namespace device ...@@ -98,17 +98,17 @@ namespace cv { namespace gpu { namespace device
using namespace ::cv::gpu::device; using namespace ::cv::gpu::device;
cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size, Size block_size, Size block_stride, Size cell_size, cv::gpu::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size block_stride_, Size cell_size_,
int nbins, double win_sigma, double threshold_L2hys, bool gamma_correction, int nlevels) int nbins_, double win_sigma_, double threshold_L2hys_, bool gamma_correction_, int nlevels_)
: win_size(win_size), : win_size(win_size_),
block_size(block_size), block_size(block_size_),
block_stride(block_stride), block_stride(block_stride_),
cell_size(cell_size), cell_size(cell_size_),
nbins(nbins), nbins(nbins_),
win_sigma(win_sigma), win_sigma(win_sigma_),
threshold_L2hys(threshold_L2hys), threshold_L2hys(threshold_L2hys_),
gamma_correction(gamma_correction), gamma_correction(gamma_correction_),
nlevels(nlevels) nlevels(nlevels_)
{ {
CV_Assert((win_size.width - block_size.width ) % block_stride.width == 0 && CV_Assert((win_size.width - block_size.width ) % block_stride.width == 0 &&
(win_size.height - block_size.height) % block_stride.height == 0); (win_size.height - block_size.height) % block_stride.height == 0);
...@@ -149,9 +149,9 @@ bool cv::gpu::HOGDescriptor::checkDetectorSize() const ...@@ -149,9 +149,9 @@ bool cv::gpu::HOGDescriptor::checkDetectorSize() const
return detector_size == 0 || detector_size == descriptor_size || detector_size == descriptor_size + 1; return detector_size == 0 || detector_size == descriptor_size || detector_size == descriptor_size + 1;
} }
void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector) void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& _detector)
{ {
std::vector<float> detector_reordered(detector.size()); std::vector<float> detector_reordered(_detector.size());
size_t block_hist_size = getBlockHistogramSize(); size_t block_hist_size = getBlockHistogramSize();
cv::Size blocks_per_img = numPartsWithin(win_size, block_size, block_stride); cv::Size blocks_per_img = numPartsWithin(win_size, block_size, block_stride);
...@@ -159,7 +159,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector) ...@@ -159,7 +159,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector)
for (int i = 0; i < blocks_per_img.height; ++i) for (int i = 0; i < blocks_per_img.height; ++i)
for (int j = 0; j < blocks_per_img.width; ++j) for (int j = 0; j < blocks_per_img.width; ++j)
{ {
const float* src = &detector[0] + (j * blocks_per_img.height + i) * block_hist_size; const float* src = &_detector[0] + (j * blocks_per_img.height + i) * block_hist_size;
float* dst = &detector_reordered[0] + (i * blocks_per_img.width + j) * block_hist_size; float* dst = &detector_reordered[0] + (i * blocks_per_img.width + j) * block_hist_size;
for (size_t k = 0; k < block_hist_size; ++k) for (size_t k = 0; k < block_hist_size; ++k)
dst[k] = src[k]; dst[k] = src[k];
...@@ -168,7 +168,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector) ...@@ -168,7 +168,7 @@ void cv::gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector)
this->detector.upload(Mat(detector_reordered).reshape(1, 1)); this->detector.upload(Mat(detector_reordered).reshape(1, 1));
size_t descriptor_size = getDescriptorSize(); size_t descriptor_size = getDescriptorSize();
free_coef = detector.size() > descriptor_size ? detector[descriptor_size] : 0; free_coef = _detector.size() > descriptor_size ? _detector[descriptor_size] : 0;
CV_Assert(checkDetectorSize()); CV_Assert(checkDetectorSize());
} }
...@@ -190,24 +190,24 @@ cv::gpu::GpuMat cv::gpu::HOGDescriptor::getBuffer(int rows, int cols, int type, ...@@ -190,24 +190,24 @@ cv::gpu::GpuMat cv::gpu::HOGDescriptor::getBuffer(int rows, int cols, int type,
} }
void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle) void cv::gpu::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& _grad, GpuMat& _qangle)
{ {
CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4); CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
// grad.create(img.size(), CV_32FC2); // grad.create(img.size(), CV_32FC2);
grad = getBuffer(img.size(), CV_32FC2, grad_buf); _grad = getBuffer(img.size(), CV_32FC2, grad_buf);
// qangle.create(img.size(), CV_8UC2); // qangle.create(img.size(), CV_8UC2);
qangle = getBuffer(img.size(), CV_8UC2, qangle_buf); _qangle = getBuffer(img.size(), CV_8UC2, qangle_buf);
float angleScale = (float)(nbins / CV_PI); float angleScale = (float)(nbins / CV_PI);
switch (img.type()) switch (img.type())
{ {
case CV_8UC1: case CV_8UC1:
hog::compute_gradients_8UC1(nbins, img.rows, img.cols, img, angleScale, grad, qangle, gamma_correction); hog::compute_gradients_8UC1(nbins, img.rows, img.cols, img, angleScale, _grad, _qangle, gamma_correction);
break; break;
case CV_8UC4: case CV_8UC4:
hog::compute_gradients_8UC4(nbins, img.rows, img.cols, img, angleScale, grad, qangle, gamma_correction); hog::compute_gradients_8UC4(nbins, img.rows, img.cols, img, angleScale, _grad, _qangle, gamma_correction);
break; break;
} }
} }
...@@ -323,8 +323,8 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& f ...@@ -323,8 +323,8 @@ void cv::gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& f
for (size_t i = 0; i < level_scale.size(); i++) for (size_t i = 0; i < level_scale.size(); i++)
{ {
double scale = level_scale[i]; double _scale = level_scale[i];
Size sz(cvRound(img.cols / scale), cvRound(img.rows / scale)); Size sz(cvRound(img.cols / _scale), cvRound(img.rows / _scale));
GpuMat smaller_img; GpuMat smaller_img;
if (sz == img.size()) if (sz == img.size())
......
...@@ -78,7 +78,7 @@ template <typename T> ...@@ -78,7 +78,7 @@ template <typename T>
struct GraphEdge struct GraphEdge
{ {
GraphEdge() {} GraphEdge() {}
GraphEdge(int to, int next, const T& val) : to(to), next(next), val(val) {} GraphEdge(int to_, int next_, const T& val_) : to(to_), next(next_), val(val_) {}
int to; int to;
int next; int next;
T val; T val;
...@@ -110,7 +110,7 @@ private: ...@@ -110,7 +110,7 @@ private:
struct SegmLinkVal struct SegmLinkVal
{ {
SegmLinkVal() {} SegmLinkVal() {}
SegmLinkVal(int dr, int dsp) : dr(dr), dsp(dsp) {} SegmLinkVal(int dr_, int dsp_) : dr(dr_), dsp(dsp_) {}
bool operator <(const SegmLinkVal& other) const bool operator <(const SegmLinkVal& other) const
{ {
return dr + dsp < other.dr + other.dsp; return dr + dsp < other.dr + other.dsp;
...@@ -123,8 +123,8 @@ struct SegmLinkVal ...@@ -123,8 +123,8 @@ struct SegmLinkVal
struct SegmLink struct SegmLink
{ {
SegmLink() {} SegmLink() {}
SegmLink(int from, int to, const SegmLinkVal& val) SegmLink(int from_, int to_, const SegmLinkVal& val_)
: from(from), to(to), val(val) {} : from(from_), to(to_), val(val_) {}
bool operator <(const SegmLink& other) const bool operator <(const SegmLink& other) const
{ {
return val < other.val; return val < other.val;
...@@ -182,10 +182,10 @@ inline int DjSets::merge(int set1, int set2) ...@@ -182,10 +182,10 @@ inline int DjSets::merge(int set1, int set2)
template <typename T> template <typename T>
Graph<T>::Graph(int numv, int nume_max) : start(numv, -1), edges(nume_max) Graph<T>::Graph(int numv_, int nume_max_) : start(numv_, -1), edges(nume_max_)
{ {
this->numv = numv; this->numv = numv_;
this->nume_max = nume_max; this->nume_max = nume_max_;
nume = 0; nume = 0;
} }
......
...@@ -193,10 +193,10 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat& mbuf, GpuMat& te ...@@ -193,10 +193,10 @@ static void csbp_operator(StereoConstantSpaceBP& rthis, GpuMat& mbuf, GpuMat& te
GpuMat sub2 = sub1.rowRange((k+0)*sub1.rows/2, (k+1)*sub1.rows/2); GpuMat sub2 = sub1.rowRange((k+0)*sub1.rows/2, (k+1)*sub1.rows/2);
GpuMat *buf_ptrs[] = { &u[k], &d[k], &l[k], &r[k], &disp_selected_pyr[k] }; GpuMat *buf_ptrs[] = { &u[k], &d[k], &l[k], &r[k], &disp_selected_pyr[k] };
for(int r = 0; r < 5; ++r) for(int _r = 0; _r < 5; ++_r)
{ {
*buf_ptrs[r] = sub2.rowRange(r * sub2.rows/5, (r+1) * sub2.rows/5); *buf_ptrs[_r] = sub2.rowRange(_r * sub2.rows/5, (_r+1) * sub2.rows/5);
assert(buf_ptrs[r]->cols == cols && buf_ptrs[r]->rows == rows * rthis.nr_plane); assert(buf_ptrs[_r]->cols == cols && buf_ptrs[_r]->rows == rows * rthis.nr_plane);
} }
}; };
......
...@@ -198,7 +198,7 @@ Trains an SVM with optimal parameters. ...@@ -198,7 +198,7 @@ Trains an SVM with optimal parameters.
.. ocv:pyfunction:: cv2.SVM.train_auto(trainData, responses, varIdx, sampleIdx, params[, k_fold[, Cgrid[, gammaGrid[, pGrid[, nuGrid[, coeffGrid[, degreeGrid[, balanced]]]]]]]]) -> retval .. ocv:pyfunction:: cv2.SVM.train_auto(trainData, responses, varIdx, sampleIdx, params[, k_fold[, Cgrid[, gammaGrid[, pGrid[, nuGrid[, coeffGrid[, degreeGrid[, balanced]]]]]]]]) -> retval
:param k_fold: Cross-validation parameter. The training set is divided into ``k_fold`` subsets. One subset is used to train the model, the others form the test set. So, the SVM algorithm is executed ``k_fold`` times. :param k_fold: Cross-validation parameter. The training set is divided into ``k_fold`` subsets. One subset is used to test the model, the others form the train set. So, the SVM algorithm is executed ``k_fold`` times.
:param \*Grid: Iteration grid for the corresponding SVM parameter. :param \*Grid: Iteration grid for the corresponding SVM parameter.
......
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Sample - 15-puzzle" --path ./15-puzzle call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Sample - 15-puzzle" --path ./15-puzzle
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Sample - face-detection" --path ./face-detection call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Sample - face-detection" --path ./face-detection
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Sample - image-manipulations" --path ./image-manipulations call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Sample - image-manipulations" --path ./image-manipulations
android update project --target android-11 --name "Tutorial 0 (Basic) - Android Camera" --path ./tutorial-0-androidcamera call android update project --target android-11 --name "Tutorial 0 (Basic) - Android Camera" --path ./tutorial-0-androidcamera
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Tutorial 1 (Basic) - Add OpenCV" --path ./tutorial-1-addopencv call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Tutorial 1 (Basic) - Add OpenCV" --path ./tutorial-1-addopencv
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Tutorial 2 (Basic) - Use OpenCV Camera" --path ./tutorial-2-opencvcamera call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Tutorial 2 (Basic) - Use OpenCV Camera" --path ./tutorial-2-opencvcamera
android update project --target android-11 --name "Tutorial 3 (Advanced) - Add Native OpenCV" --path ./tutorial-3-native call android update project --target android-11 --name "Tutorial 3 (Advanced) - Add Native OpenCV" --path ./tutorial-3-native
android update project --target android-11 --library ../../OpenCV-2.4.0/ --name "Tutorial 4 (Advanced) - Mix Java+Native OpenCV" --path ./tutorial-4-mixed call android update project --target android-11 --library ../../OpenCV-2.4.1/ --name "Tutorial 4 (Advanced) - Mix Java+Native OpenCV" --path ./tutorial-4-mixed
\ No newline at end of file \ No newline at end of file
...@@ -146,7 +146,7 @@ int main(int argc, char** argv) ...@@ -146,7 +146,7 @@ int main(int argc, char** argv)
minGradMagnitudes[3] = 1; minGradMagnitudes[3] = 1;
const float minDepth = 0.f; //in meters const float minDepth = 0.f; //in meters
const float maxDepth = 3.f; //in meters const float maxDepth = 4.f; //in meters
const float maxDepthDiff = 0.07f; //in meters const float maxDepthDiff = 0.07f; //in meters
tm.start(); tm.start();
......
'''
K-means clusterization sample.
Usage:
kmeans.py
Keyboard shortcuts:
ESC - exit
space - generate new distribution
'''
import numpy as np
import cv2
from gaussian_mix import make_gaussians
if __name__ == '__main__':
cluster_n = 5
img_size = 512
print __doc__
# generating bright palette
colors = np.zeros((1, cluster_n, 3), np.uint8)
colors[0,:] = 255
colors[0,:,0] = np.arange(0, 180, 180.0/cluster_n)
colors = cv2.cvtColor(colors, cv2.COLOR_HSV2BGR)[0]
while True:
print 'sampling distributions...'
points, _ = make_gaussians(cluster_n, img_size)
term_crit = (cv2.TERM_CRITERIA_EPS, 30, 0.1)
ret, labels, centers = cv2.kmeans(points, cluster_n, term_crit, 10, 0)
img = np.zeros((img_size, img_size, 3), np.uint8)
for (x, y), label in zip(np.int32(points), labels.ravel()):
c = map(int, colors[label])
cv2.circle(img, (x, y), 1, c, -1)
cv2.imshow('gaussian mixture', img)
ch = 0xFF & cv2.waitKey(0)
if ch == 27:
break
cv2.destroyAllWindows()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment