Merge remote-tracking branch 'refs/remotes/upstream/master'

This commit is contained in:
Olexa Bilaniuk 2015-03-14 12:41:56 -04:00
commit ac1099deb8
26 changed files with 267 additions and 69 deletions

View File

@ -624,19 +624,23 @@ include(cmake/OpenCVGenConfig.cmake)
include(cmake/OpenCVGenInfoPlist.cmake) include(cmake/OpenCVGenInfoPlist.cmake)
# Generate environment setup file # Generate environment setup file
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX) if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
if(ANDROID) if(ANDROID)
get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY) get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY) "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT tests) DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT tests)
else() elseif(WIN32)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_windows.cmd.in"
"${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd" @ONLY)
install(PROGRAMS "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd"
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
elseif(UNIX)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY) "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests) DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
endif() endif()
endif() endif()
@ -995,7 +999,7 @@ if(WITH_IPP AND HAVE_IPP)
status(" linked:" BUILD_WITH_DYNAMIC_IPP THEN "dynamic" ELSE "static") status(" linked:" BUILD_WITH_DYNAMIC_IPP THEN "dynamic" ELSE "static")
endif() endif()
else() else()
status(" Use IPP:" WITH_IPP AND NOT HAVE_IPP THEN "IPP not found" ELSE NO) status(" Use IPP:" WITH_IPP AND NOT HAVE_IPP THEN "IPP not found or implicitly disabled" ELSE NO)
endif() endif()
if(DEFINED WITH_IPP_A) if(DEFINED WITH_IPP_A)

View File

@ -154,6 +154,15 @@ void get_annotations(Mat input_image, stringstream* output_stream)
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
// If no arguments are given, then supply some information on how this tool works
if( argc == 1 ){
cout << "Usage: " << argv[0] << endl;
cout << " -images <folder_location> [example - /data/testimages/]" << endl;
cout << " -annotations <ouput_file> [example - /data/annotations.txt]" << endl;
return -1;
}
// Read in the input arguments // Read in the input arguments
string image_folder; string image_folder;
string annotations; string annotations;

View File

@ -75,10 +75,10 @@ function(find_python preferred_version min_version library_env include_dir_env
if(NOT ANDROID AND NOT IOS) if(NOT ANDROID AND NOT IOS)
ocv_check_environment_variables(${library_env} ${include_dir_env}) ocv_check_environment_variables(${library_env} ${include_dir_env})
if(${library}) if(${${library_env}})
set(PYTHON_LIBRARY "${${library_env}}") set(PYTHON_LIBRARY "${${library_env}}")
endif() endif()
if(${include_dir}) if(${${include_dir_env}})
set(PYTHON_INCLUDE_DIR "${${include_dir_env}}") set(PYTHON_INCLUDE_DIR "${${include_dir_env}}")
endif() endif()

View File

@ -34,6 +34,11 @@ unset(IPP_VERSION_MAJOR)
unset(IPP_VERSION_MINOR) unset(IPP_VERSION_MINOR)
unset(IPP_VERSION_BUILD) unset(IPP_VERSION_BUILD)
if (X86 AND UNIX AND NOT APPLE AND NOT ANDROID AND BUILD_SHARED_LIBS)
message(STATUS "On 32-bit Linux IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF")
return()
endif()
set(IPP_X64 0) set(IPP_X64 0)
if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(IPP_X64 1) set(IPP_X64 1)

View File

@ -57,54 +57,54 @@ set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_SECTION "libs") set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
#display names
set(CPACK_COMPONENT_DEV_DISPLAY_NAME "Development files")
set(CPACK_COMPONENT_DOCS_DISPLAY_NAME "Documentation")
set(CPACK_COMPONENT_JAVA_DISPLAY_NAME "Java bindings")
set(CPACK_COMPONENT_LIBS_DISPLAY_NAME "Libraries and data")
set(CPACK_COMPONENT_PYTHON_DISPLAY_NAME "Python bindings")
set(CPACK_COMPONENT_SAMPLES_DISPLAY_NAME "Samples")
set(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Tests")
#depencencies #depencencies
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE) set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
set(CPACK_COMPONENT_samples_DEPENDS libs) set(CPACK_COMPONENT_LIBS_REQUIRED TRUE)
set(CPACK_COMPONENT_dev_DEPENDS libs) set(CPACK_COMPONENT_SAMPLES_DEPENDS libs)
set(CPACK_COMPONENT_docs_DEPENDS libs) set(CPACK_COMPONENT_DEV_DEPENDS libs)
set(CPACK_COMPONENT_java_DEPENDS libs) set(CPACK_COMPONENT_DOCS_DEPENDS libs)
set(CPACK_COMPONENT_python_DEPENDS libs) set(CPACK_COMPONENT_JAVA_DEPENDS libs)
set(CPACK_COMPONENT_tests_DEPENDS libs) set(CPACK_COMPONENT_PYTHON_DEPENDS libs)
set(CPACK_COMPONENT_TESTS_DEPENDS libs)
if(HAVE_CUDA) if(HAVE_CUDA)
string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION}) string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}") set(CPACK_DEB_LIBS_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
set(CPACK_COMPONENT_dev_DEPENDS libs) set(CPACK_DEB_DEV_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
endif() endif()
if(NOT OPENCV_CUSTOM_PACKAGE_INFO) if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
set(CPACK_COMPONENT_libs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}") set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library")
set(CPACK_COMPONENT_libs_DESCRIPTION "Open Computer Vision Library") set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "lib${CMAKE_PROJECT_NAME}")
set(CPACK_COMPONENT_python_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-python") set(CPACK_COMPONENT_PYTHON_DESCRIPTION "Python bindings for Open Source Computer Vision Library")
set(CPACK_COMPONENT_python_DESCRIPTION "Python bindings for Open Source Computer Vision Library") set(CPACK_DEBIAN_COMPONENT_PYTHON_NAME "lib${CMAKE_PROJECT_NAME}-python")
set(CPACK_COMPONENT_java_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-java") set(CPACK_COMPONENT_JAVA_DESCRIPTION "Java bindings for Open Source Computer Vision Library")
set(CPACK_COMPONENT_java_DESCRIPTION "Java bindings for Open Source Computer Vision Library") set(CPACK_DEBIAN_COMPONENT_JAVA_NAME "lib${CMAKE_PROJECT_NAME}-java")
set(CPACK_COMPONENT_dev_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-dev") set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for Open Source Computer Vision Library")
set(CPACK_COMPONENT_dev_DESCRIPTION "Development files for Open Source Computer Vision Library") set(CPACK_DEBIAN_COMPONENT_DEV_NAME "lib${CMAKE_PROJECT_NAME}-dev")
set(CPACK_COMPONENT_docs_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-docs") set(CPACK_COMPONENT_DOCS_DESCRIPTION "Documentation for Open Source Computer Vision Library")
set(CPACK_COMPONENT_docs_DESCRIPTION "Documentation for Open Source Computer Vision Library") set(CPACK_DEBIAN_COMPONENT_DOCS_NAME "lib${CMAKE_PROJECT_NAME}-docs")
set(CPACK_COMPONENT_samples_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-samples") set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Samples for Open Source Computer Vision Library")
set(CPACK_COMPONENT_samples_DESCRIPTION "Samples for Open Source Computer Vision Library") set(CPACK_DEBIAN_COMPONENT_SAMPLES_NAME "lib${CMAKE_PROJECT_NAME}-samples")
set(CPACK_COMPONENT_tests_DISPLAY_NAME "lib${CMAKE_PROJECT_NAME}-tests") set(CPACK_COMPONENT_TESTS_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library")
set(CPACK_COMPONENT_tests_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library") set(CPACK_DEBIAN_COMPONENT_TESTS_NAME "lib${CMAKE_PROJECT_NAME}-tests")
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO) endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
if(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT)
set(CPACK_libs_COMPONENT_INSTALL TRUE)
set(CPACK_dev_COMPONENT_INSTALL TRUE)
set(CPACK_docs_COMPONENT_INSTALL TRUE)
set(CPACK_python_COMPONENT_INSTALL TRUE)
set(CPACK_java_COMPONENT_INSTALL TRUE)
set(CPACK_samples_COMPONENT_INSTALL TRUE)
endif(NOT OPENCV_CUSTOM_PACKAGE_LAYOUT)
include(CPack) include(CPack)
ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

View File

@ -0,0 +1,74 @@
@echo OFF
setlocal ENABLEDELAYEDEXPANSION
rem Process command line
rem This script is designed to allow situations when the tests are installed in
rem a different directory from the library.
set OPENCV_DIR=%~1
if "%OPENCV_DIR%" == "" (
echo>&2 This script runs the OpenCV tests on Windows.
echo>&2
echo>&2 usage: %0 ^<OpenCV install directory^>
exit /B 1
)
if NOT EXIST "%OPENCV_DIR%" (
echo>&2 error: "%OPENCV_DIR%" doesn't exist
)
rem Set up paths
set PATH=%OPENCV_DIR%\@OPENCV_BIN_INSTALL_PATH@;%PATH%
set OPENCV_TEST_PATH=%~dp0
set OPENCV_TEST_DATA_PATH=%OPENCV_TEST_PATH%\..\testdata
rem Run tests
set SUMMARY_STATUS=0
set FAILED_TESTS=
set PASSED_TESTS=
for %%t IN ("%OPENCV_TEST_PATH%\opencv_test_*.exe" "%OPENCV_TEST_PATH%\opencv_perf_*.exe") DO (
set test_name=%%~nt
set report=!test_name!.xml
set cmd="%%t" --perf_min_samples=1 --perf_force_samples=1 "--gtest_output=xml:!report!"
echo [!test_name!] RUN : !cmd!
!cmd!
set ret=!errorlevel!
echo [!test_name!] RETURN_CODE : !ret!
if !ret! EQU 0 (
echo [!test_name!] OK
set PASSED_TESTS=!PASSED_TESTS! !test_name!
) ELSE (
echo [!test_name!] FAILED
set SUMMARY_STATUS=1
set FAILED_TESTS=!FAILED_TESTS! !test_name!
)
echo.
)
rem Remove temporary test files
del /F /Q "%TMP%\ocv*.tmp*"
rem Report final status
echo ===============================================================
echo PASSED TESTS : %PASSED_TESTS%
echo FAILED TESTS : %FAILED_TESTS%
if %SUMMARY_STATUS% EQU 0 (
echo STATUS : OK
echo STATUS : All OpenCV tests finished successfully
) ELSE (
echo STATUS : FAIL
echo STATUS : OpenCV tests finished with status %SUMMARY_STATUS%
)
exit /B %SUMMARY_STATUS%

View File

@ -4,7 +4,7 @@ file(GLOB LBP_CASCADES lbpcascades/*.xml)
if(ANDROID) if(ANDROID)
install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT libs) install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT libs)
install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT libs) install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT libs)
elseif(NOT WIN32) else()
install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT libs) install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT libs)
install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs) install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs)
endif() endif()

View File

@ -2,7 +2,11 @@
# CMake file for OpenCV docs # CMake file for OpenCV docs
#----------------------- #-----------------------
set(HAVE_DOC_GENERATOR BUILD_DOCS AND DOXYGEN_FOUND) if(BUILD_DOCS AND DOXYGEN_FOUND)
set(HAVE_DOC_GENERATOR TRUE)
else()
set(HAVE_DOC_GENERATOR FALSE)
endif()
if(HAVE_DOC_GENERATOR) if(HAVE_DOC_GENERATOR)
project(opencv_docs) project(opencv_docs)

View File

@ -7,7 +7,7 @@ Introduction
The work with a cascade classifier inlcudes two major stages: training and detection. Detection The work with a cascade classifier inlcudes two major stages: training and detection. Detection
stage is described in a documentation of objdetect module of general OpenCV documentation. stage is described in a documentation of objdetect module of general OpenCV documentation.
Documentation gives some basic information about cascade classifier. Current guide is describing how Documentation gives some basic information about cascade classifier. Current guide is describing how
to train a cascade classifier: preparation of a training data and running the training application. to train a cascade classifier: preparation of the training data and running the training application.
### Important notes ### Important notes
@ -58,9 +58,9 @@ Negative samples are taken from arbitrary images. These images must not contain
Negative samples are enumerated in a special file. It is a text file in which each line contains an Negative samples are enumerated in a special file. It is a text file in which each line contains an
image filename (relative to the directory of the description file) of negative sample image. This image filename (relative to the directory of the description file) of negative sample image. This
file must be created manually. Note that negative samples and sample images are also called file must be created manually. Note that negative samples and sample images are also called
background samples or background samples images, and are used interchangeably in this document. background samples or background images, and are used interchangeably in this document.
Described images may be of different sizes. But each image should be (but not nessesarily) larger Described images may be of different sizes. But each image should be (but not nessesarily) larger
then a training window size, because these images are used to subsample negative image to the than a training window size, because these images are used to subsample negative image to the
training size. training size.
An example of description file: An example of description file:

View File

@ -196,6 +196,10 @@
# define CV_NEON 1 # define CV_NEON 1
#endif #endif
#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__)
# define CV_VFP 1
#endif
#endif // __CUDACC__ #endif // __CUDACC__
#ifndef CV_POPCNT #ifndef CV_POPCNT
@ -263,6 +267,10 @@
# define CV_NEON 0 # define CV_NEON 0
#endif #endif
#ifndef CV_VFP
# define CV_VFP 0
#endif
/* primitive types */ /* primitive types */
/* /*
schar - signed 1 byte integer schar - signed 1 byte integer
@ -437,6 +445,23 @@ typedef signed char schar;
//! @addtogroup core_utils //! @addtogroup core_utils
//! @{ //! @{
#if CV_VFP
// 1. general scheme
#define ARM_ROUND(_value, _asm_string) \
int res; \
float temp; \
asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \
return res;
// 2. version for double
#ifdef __clang__
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]")
#else
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]")
#endif
// 3. version for float
#define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]")
#endif // CV_VFP
/** @brief Rounds floating-point number to the nearest integer /** @brief Rounds floating-point number to the nearest integer
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
@ -460,6 +485,8 @@ CV_INLINE int cvRound( double value )
#elif defined CV_ICC || defined __GNUC__ #elif defined CV_ICC || defined __GNUC__
# ifdef HAVE_TEGRA_OPTIMIZATION # ifdef HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND(value); TEGRA_ROUND(value);
# elif CV_VFP
ARM_ROUND_DBL(value)
# else # else
return (int)lrint(value); return (int)lrint(value);
# endif # endif
@ -473,6 +500,26 @@ CV_INLINE int cvRound( double value )
#endif #endif
} }
#ifdef __cplusplus
/** @overload */
CV_INLINE int cvRound(float value)
{
#if CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
ARM_ROUND_FLT(value)
#else
return cvRound((double)value);
#endif
}
/** @overload */
CV_INLINE int cvRound(int value)
{
return value;
}
#endif // __cplusplus
/** @brief Rounds floating-point number to the nearest integer not larger than the original. /** @brief Rounds floating-point number to the nearest integer not larger than the original.
The function computes an integer i such that: The function computes an integer i such that:

View File

@ -2651,7 +2651,6 @@ CV_IMPL CvFileStorage*
cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, const char* encoding ) cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, const char* encoding )
{ {
CvFileStorage* fs = 0; CvFileStorage* fs = 0;
char* xml_buf = 0;
int default_block_size = 1 << 18; int default_block_size = 1 << 18;
bool append = (flags & 3) == CV_STORAGE_APPEND; bool append = (flags & 3) == CV_STORAGE_APPEND;
bool mem = (flags & CV_STORAGE_MEMORY) != 0; bool mem = (flags & CV_STORAGE_MEMORY) != 0;
@ -2692,7 +2691,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
(dot_pos[3] == '\0' || (cv_isdigit(dot_pos[3]) && dot_pos[4] == '\0')) ) (dot_pos[3] == '\0' || (cv_isdigit(dot_pos[3]) && dot_pos[4] == '\0')) )
{ {
if( append ) if( append )
{
cvReleaseFileStorage( &fs );
CV_Error(CV_StsNotImplemented, "Appending data to compressed file is not implemented" ); CV_Error(CV_StsNotImplemented, "Appending data to compressed file is not implemented" );
}
isGZ = true; isGZ = true;
compression = dot_pos[3]; compression = dot_pos[3];
if( compression ) if( compression )
@ -2713,6 +2715,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
if( !fs->gzfile ) if( !fs->gzfile )
goto _exit_; goto _exit_;
#else #else
cvReleaseFileStorage( &fs );
CV_Error(CV_StsNotImplemented, "There is no compressed file storage support in this configuration"); CV_Error(CV_StsNotImplemented, "There is no compressed file storage support in this configuration");
#endif #endif
} }
@ -2765,7 +2768,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
if( strcmp( encoding, "UTF-16" ) == 0 || if( strcmp( encoding, "UTF-16" ) == 0 ||
strcmp( encoding, "utf-16" ) == 0 || strcmp( encoding, "utf-16" ) == 0 ||
strcmp( encoding, "Utf-16" ) == 0 ) strcmp( encoding, "Utf-16" ) == 0 )
{
cvReleaseFileStorage( &fs );
CV_Error( CV_StsBadArg, "UTF-16 XML encoding is not supported! Use 8-bit encoding\n"); CV_Error( CV_StsBadArg, "UTF-16 XML encoding is not supported! Use 8-bit encoding\n");
}
CV_Assert( strlen(encoding) < 1000 ); CV_Assert( strlen(encoding) < 1000 );
char buf[1100]; char buf[1100];
@ -2783,7 +2789,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
int last_occurence = -1; int last_occurence = -1;
xml_buf_size = MIN(xml_buf_size, int(file_size)); xml_buf_size = MIN(xml_buf_size, int(file_size));
fseek( fs->file, -xml_buf_size, SEEK_END ); fseek( fs->file, -xml_buf_size, SEEK_END );
xml_buf = (char*)cvAlloc( xml_buf_size+2 ); char* xml_buf = (char*)cvAlloc( xml_buf_size+2 );
// find the last occurence of </opencv_storage> // find the last occurence of </opencv_storage>
for(;;) for(;;)
{ {
@ -2801,8 +2807,12 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
ptr += strlen(substr); ptr += strlen(substr);
} }
} }
cvFree( &xml_buf );
if( last_occurence < 0 ) if( last_occurence < 0 )
{
cvReleaseFileStorage( &fs );
CV_Error( CV_StsError, "Could not find </opencv_storage> in the end of file.\n" ); CV_Error( CV_StsError, "Could not find </opencv_storage> in the end of file.\n" );
}
icvCloseFile( fs ); icvCloseFile( fs );
fs->file = fopen( fs->filename, "r+t" ); fs->file = fopen( fs->filename, "r+t" );
fseek( fs->file, last_occurence, SEEK_SET ); fseek( fs->file, last_occurence, SEEK_SET );
@ -2876,10 +2886,18 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
//mode = cvGetErrMode(); //mode = cvGetErrMode();
//cvSetErrMode( CV_ErrModeSilent ); //cvSetErrMode( CV_ErrModeSilent );
if( fs->fmt == CV_STORAGE_FORMAT_XML ) try
icvXMLParse( fs ); {
else if( fs->fmt == CV_STORAGE_FORMAT_XML )
icvYMLParse( fs ); icvXMLParse( fs );
else
icvYMLParse( fs );
}
catch (...)
{
cvReleaseFileStorage( &fs );
throw;
}
//cvSetErrMode( mode ); //cvSetErrMode( mode );
// release resources that we do not need anymore // release resources that we do not need anymore
@ -2904,7 +2922,6 @@ _exit_:
} }
} }
cvFree( &xml_buf );
return fs; return fs;
} }

View File

@ -2320,7 +2320,10 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R : depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R :
depth == CV_8S ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1R : depth == CV_8S ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1R :
depth == CV_16U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R : depth == CV_16U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R :
depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : 0; #if !((defined _MSC_VER && defined _M_IX86) || defined __i386__)
depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R :
#endif
0;
CV_SUPPRESS_DEPRECATED_END CV_SUPPRESS_DEPRECATED_END
if( ippFuncC1 ) if( ippFuncC1 )

View File

@ -464,6 +464,7 @@ static int icvInitSystem(int* c, char** v)
if (!QApplication::instance()) if (!QApplication::instance())
{ {
new QApplication(*c, v); new QApplication(*c, v);
setlocale(LC_NUMERIC,"C");
qDebug() << "init done"; qDebug() << "init done";

View File

@ -146,6 +146,7 @@ CV_IMPL int cvInitSystem( int argc, char** argv )
} }
wasInitialized = 1; wasInitialized = 1;
} }
setlocale(LC_NUMERIC,"C");
return 0; return 0;
} }

View File

@ -156,6 +156,8 @@ CV_IMPL int cvInitSystem( int , char** )
//[application finishLaunching]; //[application finishLaunching];
//atexit(icvCocoaCleanup); //atexit(icvCocoaCleanup);
setlocale(LC_NUMERIC,"C");
return 0; return 0;
} }

View File

@ -260,6 +260,8 @@ CV_IMPL int cvInitSystem( int, char** )
wasInitialized = 1; wasInitialized = 1;
} }
setlocale(LC_NUMERIC,"C");
return 0; return 0;
} }

View File

@ -5454,7 +5454,7 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
const ocl::Device & dev = ocl::Device::getDefault(); const ocl::Device & dev = ocl::Device::getDefault();
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
double doubleSupport = dev.doubleFPConfig() > 0; const bool doubleSupport = dev.doubleFPConfig() > 0;
int interpolation = flags & INTER_MAX; int interpolation = flags & INTER_MAX;
if( interpolation == INTER_AREA ) if( interpolation == INTER_AREA )

View File

@ -1339,7 +1339,7 @@ public:
//! Regularization kinds //! Regularization kinds
enum RegKinds { enum RegKinds {
REG_NONE = -1, //!< Regularization disabled REG_DISABLE = -1, //!< Regularization disabled
REG_L1 = 0, //!< %L1 norm REG_L1 = 0, //!< %L1 norm
REG_L2 = 1 //!< %L2 norm REG_L2 = 1 //!< %L2 norm
}; };

View File

@ -322,7 +322,7 @@ double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels
theta_b = _init_theta(Range(1, n), Range::all()); theta_b = _init_theta(Range(1, n), Range::all());
multiply(theta_b, theta_b, theta_c, 1); multiply(theta_b, theta_b, theta_c, 1);
if(params.norm != REG_NONE) if (params.norm != REG_DISABLE)
{ {
llambda = 1; llambda = 1;
} }
@ -377,7 +377,7 @@ Mat LogisticRegressionImpl::compute_batch_gradient(const Mat& _data, const Mat&
m = _data.rows; m = _data.rows;
n = _data.cols; n = _data.cols;
if(params.norm != REG_NONE) if (params.norm != REG_DISABLE)
{ {
llambda = 1; llambda = 1;
} }
@ -449,7 +449,7 @@ Mat LogisticRegressionImpl::compute_mini_batch_gradient(const Mat& _data, const
Mat data_d; Mat data_d;
Mat labels_l; Mat labels_l;
if(params.norm != REG_NONE) if (params.norm != REG_DISABLE)
{ {
lambda_l = 1; lambda_l = 1;
} }

View File

@ -1235,7 +1235,9 @@ static void init_submodule(PyObject * root, const char * name, PyMethodDef * met
submod = PyImport_AddModule(full_name.c_str()); submod = PyImport_AddModule(full_name.c_str());
PyDict_SetItemString(d, short_name.c_str(), submod); PyDict_SetItemString(d, short_name.c_str(), submod);
} }
root = submod;
if (short_name != "")
root = submod;
} }
// populate module's dict // populate module's dict

View File

@ -512,7 +512,7 @@ CV_INLINE void
{ {
for (long x = 0; x < _src.cols; x++) for (long x = 0; x < _src.cols; x++)
{ {
const uchar* data = _src.ptr(y, x); const uchar* data = _src.ptr((int)y, (int)x);
//update model+ background subtract //update model+ background subtract
uchar include=0; uchar include=0;
@ -539,15 +539,15 @@ CV_INLINE void
{ {
case 0: case 0:
//foreground //foreground
*_dst.ptr(y, x) = 255; *_dst.ptr((int)y, (int)x) = 255;
break; break;
case 1: case 1:
//background //background
*_dst.ptr(y, x) = 0; *_dst.ptr((int)y, (int)x) = 0;
break; break;
case 2: case 2:
//shadow //shadow
*_dst.ptr(y, x) = nShadowDetection; *_dst.ptr((int)y, (int)x) = nShadowDetection;
break; break;
} }
i++; i++;

View File

@ -302,7 +302,15 @@ void CvCapture_FFMPEG::close()
} }
if( picture ) if( picture )
{
// FFmpeg and Libav added avcodec_free_frame in different versions.
#if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \
? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0))
avcodec_free_frame(&picture);
#else
av_free(picture); av_free(picture);
#endif
}
if( video_st ) if( video_st )
{ {

View File

@ -574,7 +574,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
return false; return false;
} }
g_object_unref(G_OBJECT(testfac)); g_object_unref(G_OBJECT(testfac));
filename = "v4lsrc ! "COLOR_ELEM" ! appsink"; filename = "v4lsrc ! " COLOR_ELEM " ! appsink";
} }
if (type == CV_CAP_GSTREAMER_V4L2){ if (type == CV_CAP_GSTREAMER_V4L2){
testfac = gst_element_factory_find("v4l2src"); testfac = gst_element_factory_find("v4l2src");
@ -582,7 +582,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
return false; return false;
} }
g_object_unref(G_OBJECT(testfac)); g_object_unref(G_OBJECT(testfac));
filename = "v4l2src ! "COLOR_ELEM" ! appsink"; filename = "v4l2src ! " COLOR_ELEM " ! appsink";
} }

View File

@ -17,14 +17,29 @@ Install Visual Studio Express 2012 for Windows Desktop
To create all Windows Phone (8.0, 8.1) and Windows Store (8.0, 8.1) Visual Studio projects To create and build all Windows Phone (8.0, 8.1) and Windows Store (8.0, 8.1) Visual Studio projects
========================================================================================== ==========================================================================================
cd opencv/platforms/winrt cd opencv/platforms/winrt
setup_winrt.bat "WP,WS" "8.0,8.1" "x86,ARM" setup_winrt.bat "WP,WS" "8.0,8.1" "x86,ARM" -b
If everything's fine, a few minutes later you will get the following output in the opencv/bin directory: If everything's fine, a few minutes later you will get the following output in the opencv/bin directory:
bin bin
install
WP
8.0
ARM
x86
8.1
ARM
x86
WS
8.0
ARM
x86
8.1
ARM
x86
WP WP
8.0 8.0
ARM ARM
@ -40,7 +55,11 @@ bin
ARM ARM
x86 x86
Build the OpenCV.sln for the particular platform you are targeting. Due to the current limitations of CMake, separate x86/x64/ARM projects must be generated for each platform. "-b" flag in the command above builds each generated solutions in both "Debug" and "Release" configurations. It also builds the predefined "INSTALL" project within generated solutions. Building it creates a separate install location that accumulates binaries and includes for specified platforms. Default location is "<ocv-src>\bin\install\".
WinRT samples reference 'install' binaries and include files via "OPENCV_WINRT_INSTALL_DIR" environment variable. Please declare it and point to "<ocv-src>\bin\install\" directory (note slash at the end) to resolve references within sample applications.
If you don't want to build all configurations automatically, you can omit "-b" flag and build OpenCV.sln for the particular platform you are targeting manually. Due to the current limitations of CMake, separate x86/x64/ARM projects must be generated for each platform.
You can also target a single specific configuration You can also target a single specific configuration
setup_winrt.bat "WP" "8.1" "x86" setup_winrt.bat "WP" "8.1" "x86"

View File

@ -403,7 +403,7 @@ void test_it( const Size & size )
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
if( argc != 4 ) if( argc != 5 )
{ {
cout << "Wrong number of parameters." << endl cout << "Wrong number of parameters." << endl
<< "Usage: " << argv[0] << " pos_dir pos.lst neg_dir neg.lst" << endl << "Usage: " << argv[0] << " pos_dir pos.lst neg_dir neg.lst" << endl

View File

@ -23,7 +23,7 @@ void drawAxis(Mat& img, Point p, Point q, Scalar colour, const float scale = 0.2
double angle; double angle;
double hypotenuse; double hypotenuse;
angle = atan2( (double) p.y - q.y, (double) p.x - q.x ); // angle in radians angle = atan2( (double) p.y - q.y, (double) p.x - q.x ); // angle in radians
hypotenuse = sqrt( (p.y - q.y) * (p.y - q.y) + (p.x - q.x) * (p.x - q.x)); hypotenuse = sqrt( (double) (p.y - q.y) * (p.y - q.y) + (p.x - q.x) * (p.x - q.x));
// double degrees = angle * 180 / CV_PI; // convert radians to degrees (0-180 range) // double degrees = angle * 180 / CV_PI; // convert radians to degrees (0-180 range)
// cout << "Degrees: " << abs(degrees - 180) << endl; // angle in 0-360 degrees range // cout << "Degrees: " << abs(degrees - 180) << endl; // angle in 0-360 degrees range