Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.4'
Browse files Browse the repository at this point in the history
Original pull requests:
	opencv#996 from jet47:gpu-nvcuvid-libraries
	opencv#995 from jet47:fix-bug-2985
	opencv#999 from snosov1:unreliable-results-fix
	opencv#1005 from alekcac:doc_fix
	opencv#1004 from jet47:fix-bug-3068
	opencv#987 from jet47:bug-3085-fix
	opencv#969 from pengx17:2.4_binary_cache
	opencv#929 from dominikrose:mingw-libdc1394-2-windows
	opencv#1000 from ivan-korolev:fix_sift_bug_2892
	opencv#1001 from ivan-korolev:fix_stitching_bug_2405
	opencv#998 from asmorkalov:android_cmake_mips_fix
	opencv#993 from ivan-korolev:fix_videostab_bug_3023
	opencv#988 from snosov1:3071-fix
	opencv#986 from pengx17:2.4_initiated_context
	opencv#982 from pengx17:2.4_fix_two_bugs
	opencv#981 from SeninAndrew:ximea_camera_support_fix
	opencv#991 from asmorkalov:android_javadoc_fix
	opencv#972 from jet47:mog2-params-bug-2168
	opencv#980 from SpecLad:include-config
	opencv#973 from pengx17:2.4_oclclahe
	opencv#903 from aks2:2.4
	opencv#968 from asmorkalov:android_na_cproj_fix
	opencv#971 from SpecLad:matchers-ctor
	opencv#970 from asmorkalov:dshow_valid_check_fix
	opencv#965 from apavlenko:fix_java_empty_mats

Conflicts:
	cmake/OpenCVModule.cmake
	modules/core/src/matmul.cpp
	modules/gpu/CMakeLists.txt
	modules/ocl/include/opencv2/ocl/ocl.hpp
	modules/ocl/perf/perf_imgproc.cpp
	modules/ocl/src/imgproc.cpp
	modules/ocl/src/initialization.cpp
	modules/stitching/src/matchers.cpp
	modules/video/src/video_init.cpp
	modules/videostab/src/global_motion.cpp
  • Loading branch information
Roman Donchenko committed Jun 19, 2013
2 parents 71db862 + 843094a commit 13cd0a0
Show file tree
Hide file tree
Showing 52 changed files with 1,405 additions and 378 deletions.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,27 @@ if(UNIX AND NOT ANDROID)
endif()
endif()

# Add these standard paths to the search paths for FIND_PATH
# to find include files from these locations first
if(MINGW)
if(EXISTS /mingw)
list(APPEND CMAKE_INCLUDE_PATH /mingw)
endif()
if(EXISTS /mingw32)
list(APPEND CMAKE_INCLUDE_PATH /mingw32)
endif()
if(EXISTS /mingw64)
list(APPEND CMAKE_INCLUDE_PATH /mingw64)
endif()
endif()

# ----------------------------------------------------------------------------
# OpenCV cmake options
# ----------------------------------------------------------------------------

# Optional 3rd party components
# ===================================================
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (UNIX AND NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS)
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
Expand Down
237 changes: 175 additions & 62 deletions android/android.toolchain.cmake

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions cmake/OpenCVDetectOpenCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,18 @@ if(OPENCL_FOUND)
set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR})
set(OPENCL_LIBRARIES ${OPENCL_LIBRARY})

if (X86_64)
if(WIN64)
set(CLAMD_POSSIBLE_LIB_SUFFIXES lib64/import)
elseif (X86)
elseif(WIN32)
set(CLAMD_POSSIBLE_LIB_SUFFIXES lib32/import)
endif()

if(X86_64 AND UNIX)
set(CLAMD_POSSIBLE_LIB_SUFFIXES lib64)
elseif(X86 AND UNIX)
set(CLAMD_POSSIBLE_LIB_SUFFIXES lib32)
endif()

if(WITH_OPENCLAMDFFT)
find_path(CLAMDFFT_ROOT_DIR
NAMES include/clAmdFft.h
Expand Down Expand Up @@ -80,7 +86,7 @@ if(OPENCL_FOUND)
if(WITH_OPENCLAMDBLAS)
find_path(CLAMDBLAS_ROOT_DIR
NAMES include/clAmdBlas.h
PATHS ENV CLAMDFFT_PATH ENV ProgramFiles
PATHS ENV CLAMDBLAS_PATH ENV ProgramFiles
PATH_SUFFIXES clAmdBlas AMD/clAmdBlas
DOC "AMD FFT root directory"
NO_DEFAULT_PATH)
Expand Down
33 changes: 28 additions & 5 deletions cmake/OpenCVFindLibsVideo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,33 @@ endif(WITH_GIGEAPI)
# --- Dc1394 ---
ocv_clear_vars(HAVE_DC1394 HAVE_DC1394_2)
if(WITH_1394)
CHECK_MODULE(libdc1394-2 HAVE_DC1394_2)
if(NOT HAVE_DC1394_2)
CHECK_MODULE(libdc1394 HAVE_DC1394)
endif()
if(WIN32 AND MINGW)
find_path(CMU1394_INCLUDE_PATH "/1394common.h"
PATH_SUFFIXES include
DOC "The path to cmu1394 headers")
find_path(DC1394_2_INCLUDE_PATH "/dc1394/dc1394.h"
PATH_SUFFIXES include
DOC "The path to DC1394 2.x headers")
if(CMU1394_INCLUDE_PATH AND DC1394_2_INCLUDE_PATH)
set(CMU1394_LIB_DIR "${CMU1394_INCLUDE_PATH}/../lib" CACHE PATH "Full path of CMU1394 library directory")
set(DC1394_2_LIB_DIR "${DC1394_2_INCLUDE_PATH}/../lib" CACHE PATH "Full path of DC1394 2.x library directory")
if(EXISTS "${CMU1394_LIB_DIR}/lib1394camera.a" AND EXISTS "${DC1394_2_LIB_DIR}/libdc1394.a")
set(HAVE_DC1394_2 TRUE)
endif()
endif()
if(HAVE_DC1394_2)
ocv_parse_pkg("libdc1394-2" "${DC1394_2_LIB_DIR}/pkgconfig" "")
ocv_include_directories(${DC1394_2_INCLUDE_PATH})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES}
"${DC1394_2_LIB_DIR}/libdc1394.a"
"${CMU1394_LIB_DIR}/lib1394camera.a")
endif(HAVE_DC1394_2)
else(WIN32 AND MINGW)
CHECK_MODULE(libdc1394-2 HAVE_DC1394_2)
if(NOT HAVE_DC1394_2)
CHECK_MODULE(libdc1394 HAVE_DC1394)
endif()
endif(WIN32 AND MINGW)
endif(WITH_1394)

# --- xine ---
Expand Down Expand Up @@ -226,7 +249,7 @@ endif(WITH_MSMF)

# --- Extra HighGUI libs on Windows ---
if(WIN32)
list(APPEND HIGHGUI_LIBRARIES comctl32 gdi32 ole32 vfw32)
list(APPEND HIGHGUI_LIBRARIES comctl32 gdi32 ole32 setupapi ws2_32 vfw32)
if(MINGW64)
list(APPEND HIGHGUI_LIBRARIES avifil32 avicap32 winmm msvfw32)
list(REMOVE_ITEM HIGHGUI_LIBRARIES vfw32)
Expand Down
14 changes: 9 additions & 5 deletions cmake/OpenCVFindXimea.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#
# Created: 5 Aug 2011 by Marian Zajko ([email protected])
# Updated: 25 June 2012 by Igor Kuzmin ([email protected])
# Updated: 22 October 2012 by Marian Zajko ([email protected])
#

set(XIMEA_FOUND)
Expand All @@ -18,11 +19,15 @@ set(XIMEA_LIBRARY_DIR)
if(WIN32)
# Try to find the XIMEA API path in registry.
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)

if(EXISTS XIMEA_PATH)
if(EXISTS ${XIMEA_PATH})
set(XIMEA_FOUND 1)
# set LIB folders
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
if(CMAKE_CL_64)
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x64")
else()
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
endif()
else()
set(XIMEA_FOUND 0)
endif()
Expand All @@ -38,5 +43,4 @@ endif()

mark_as_advanced(FORCE XIMEA_FOUND)
mark_as_advanced(FORCE XIMEA_PATH)
mark_as_advanced(FORCE XIMEA_LIBRARY_DIR)

mark_as_advanced(FORCE XIMEA_LIBRARY_DIR)
3 changes: 2 additions & 1 deletion cmake/OpenCVModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ endmacro()
# 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})
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES}
"${OPENCV_CONFIG_FILE_INCLUDE_DIR}/cvconfig.h" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp")
if(NOT the_module STREQUAL opencv_ts)
set_target_properties(${the_module} PROPERTIES COMPILE_DEFINITIONS OPENCV_NOSTL)
endif()
Expand Down
7 changes: 7 additions & 0 deletions cmake/OpenCVUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,13 @@ macro(ocv_parse_header2 LIBNAME HDR_PATH VARNAME)
endif()
endmacro()

# read single version info from the pkg file
macro(ocv_parse_pkg LIBNAME PKG_PATH SCOPE)
if(EXISTS "${PKG_PATH}/${LIBNAME}.pc")
file(STRINGS "${PKG_PATH}/${LIBNAME}.pc" line_to_parse REGEX "^Version:[ \t]+[0-9.]*.*$" LIMIT_COUNT 1)
STRING(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ALIASOF_${LIBNAME}_VERSION "${line_to_parse}" )
endif()
endmacro()

################################################################################################
# short command to setup source group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ This tutorial code's is shown lines below. You can also download it from `here <
std::vector< DMatch > good_matches;
for( int i = 0; i < descriptors_1.rows; i++ )
{ if( matches[i].distance < 2*min_dist )
{ if( matches[i].distance <= 2*min_dist )
{ good_matches.push_back( matches[i]); }
}
Expand Down Expand Up @@ -127,6 +127,3 @@ Result
.. image:: images/Feature_FlannMatcher_Keypoints_Result.jpg
:align: center
:height: 250pt



2 changes: 1 addition & 1 deletion modules/core/doc/basic_structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ Returns the depth of a matrix element.

.. ocv:function:: int Mat::depth() const
The method returns the identifier of the matrix element depth (the type of each individual channel). For example, for a 16-bit signed 3-channel array, the method returns ``CV_16S`` . A complete list of matrix types contains the following values:
The method returns the identifier of the matrix element depth (the type of each individual channel). For example, for a 16-bit signed element array, the method returns ``CV_16S`` . A complete list of matrix types contains the following values:

* ``CV_8U`` - 8-bit unsigned integers ( ``0..255`` )

Expand Down
4 changes: 2 additions & 2 deletions modules/core/perf/perf_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ PERF_TEST_P(Size_MatType_ROp, reduceR,
declare.in(src, WARMUP_RNG).out(vec);
declare.time(100);

TEST_CYCLE() reduce(src, vec, 0, reduceOp, ddepth);
int runs = 15;
TEST_CYCLE_MULTIRUN(runs) reduce(src, vec, 0, reduceOp, ddepth);

SANITY_CHECK(vec, 1);
}
Expand Down Expand Up @@ -65,4 +66,3 @@ PERF_TEST_P(Size_MatType_ROp, reduceC,

SANITY_CHECK(vec, 1);
}

57 changes: 36 additions & 21 deletions modules/core/src/matmul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2850,9 +2850,9 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, int maxComp

if( _mean.data )
{
CV_Assert( _mean.size() == mean_sz );
CV_Assert( _mean.size() == mean_sz );
_mean.convertTo(mean, ctype);
covar_flags |= CV_COVAR_USE_AVG;
covar_flags |= CV_COVAR_USE_AVG;
}

calcCovarMatrix( data, covar, mean, covar_flags, ctype );
Expand Down Expand Up @@ -2896,6 +2896,36 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, int maxComp
return *this;
}

template <typename T>
int computeCumulativeEnergy(const Mat& eigenvalues, double retainedVariance)
{
CV_DbgAssert( eigenvalues.type() == DataType<T>::type );

Mat g(eigenvalues.size(), DataType<T>::type);

for(int ig = 0; ig < g.rows; ig++)
{
g.at<T>(ig, 0) = 0;
for(int im = 0; im <= ig; im++)
{
g.at<T>(ig,0) += eigenvalues.at<T>(im,0);
}
}

int L;

for(L = 0; L < eigenvalues.rows; L++)
{
double energy = g.at<T>(L, 0) / g.at<T>(g.rows - 1, 0);
if(energy > retainedVariance)
break;
}

L = std::max(2, L);

return L;
}

PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, double retainedVariance)
{
Mat data = _data.getMat(), _mean = __mean.getMat();
Expand Down Expand Up @@ -2972,26 +3002,11 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, double reta
}

// compute the cumulative energy content for each eigenvector
Mat g(eigenvalues.size(), ctype);

for(int ig = 0; ig < g.rows; ig++)
{
g.at<float>(ig,0) = 0;
for(int im = 0; im <= ig; im++)
{
g.at<float>(ig,0) += eigenvalues.at<float>(im,0);
}
}

int L;
for(L = 0; L < eigenvalues.rows; L++)
{
double energy = g.at<float>(L, 0) / g.at<float>(g.rows - 1, 0);
if(energy > retainedVariance)
break;
}

L = std::max(2, L);
if (ctype == CV_32F)
L = computeCumulativeEnergy<float>(eigenvalues, retainedVariance);
else
L = computeCumulativeEnergy<double>(eigenvalues, retainedVariance);

// use clone() to physically copy the data and thus deallocate the original matrices
eigenvalues = eigenvalues.rowRange(0,L).clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ For each query descriptor, finds the training descriptors not farther than the s

:param compactResult: Parameter used when the mask (or masks) is not empty. If ``compactResult`` is false, the ``matches`` vector has the same size as ``queryDescriptors`` rows. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors.

:param maxDistance: Threshold for the distance between matched descriptors.
:param maxDistance: Threshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!

For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than ``maxDistance``. Found matches are returned in the distance increasing order.

Expand Down
6 changes: 5 additions & 1 deletion modules/highgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ if(HAVE_XIMEA)
if(XIMEA_LIBRARY_DIR)
link_directories(${XIMEA_LIBRARY_DIR})
endif()
list(APPEND HIGHGUI_LIBRARIES m3api)
if(CMAKE_CL_64)
list(APPEND HIGHGUI_LIBRARIES m3apiX64)
else()
list(APPEND HIGHGUI_LIBRARIES m3api)
endif()
endif(HAVE_XIMEA)

if(HAVE_FFMPEG)
Expand Down
11 changes: 10 additions & 1 deletion modules/highgui/src/cap_dc1394_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@

#include <unistd.h>
#include <stdint.h>
#include <sys/select.h>
#ifdef WIN32
// On Windows, we have no sys/select.h, but we need to pick up
// select() which is in winsock2.
#ifndef __SYS_SELECT_H__
#define __SYS_SELECT_H__ 1
#include <winsock2.h>
#endif
#else
#include <sys/select.h>
#endif /*WIN32*/
#include <dc1394/dc1394.h>
#include <stdlib.h>
#include <string.h>
Expand Down
6 changes: 4 additions & 2 deletions modules/highgui/src/cap_dshow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3193,8 +3193,10 @@ IplImage* CvCaptureCAM_DShow::retrieveFrame(int)
frame = cvCreateImage( cvSize(w,h), 8, 3 );
}

VI.getPixels( index, (uchar*)frame->imageData, false, true );
return frame;
if (VI.getPixels( index, (uchar*)frame->imageData, false, true ))
return frame;
else
return NULL;
}

double CvCaptureCAM_DShow::getProperty( int property_id )
Expand Down
Loading

0 comments on commit 13cd0a0

Please sign in to comment.