mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 13:47:32 +08:00
Merge pull request #3817 from SpecLad:forward-ports
This commit is contained in:
commit
06703c9d56
@ -624,19 +624,23 @@ include(cmake/OpenCVGenConfig.cmake)
|
||||
include(cmake/OpenCVGenInfoPlist.cmake)
|
||||
|
||||
# Generate environment setup file
|
||||
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX)
|
||||
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
|
||||
if(ANDROID)
|
||||
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"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
|
||||
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
|
||||
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"
|
||||
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
|
||||
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
|
||||
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -57,54 +57,54 @@ set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
|
||||
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
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
|
||||
set(CPACK_COMPONENT_samples_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_dev_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_docs_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_java_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_python_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_tests_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_LIBS_REQUIRED TRUE)
|
||||
set(CPACK_COMPONENT_SAMPLES_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_DEV_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_DOCS_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_JAVA_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_PYTHON_DEPENDS libs)
|
||||
set(CPACK_COMPONENT_TESTS_DEPENDS libs)
|
||||
|
||||
if(HAVE_CUDA)
|
||||
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_COMPONENT_dev_DEPENDS libs)
|
||||
set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
|
||||
set(CPACK_DEB_LIBS_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
|
||||
set(CPACK_DEB_DEV_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
|
||||
endif()
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
74
cmake/templates/opencv_run_all_tests_windows.cmd.in
Normal file
74
cmake/templates/opencv_run_all_tests_windows.cmd.in
Normal 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%
|
@ -4,7 +4,7 @@ file(GLOB LBP_CASCADES lbpcascades/*.xml)
|
||||
if(ANDROID)
|
||||
install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades 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 ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs)
|
||||
endif()
|
||||
|
@ -2,7 +2,11 @@
|
||||
# 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)
|
||||
project(opencv_docs)
|
||||
|
@ -2651,7 +2651,6 @@ CV_IMPL CvFileStorage*
|
||||
cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, const char* encoding )
|
||||
{
|
||||
CvFileStorage* fs = 0;
|
||||
char* xml_buf = 0;
|
||||
int default_block_size = 1 << 18;
|
||||
bool append = (flags & 3) == CV_STORAGE_APPEND;
|
||||
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')) )
|
||||
{
|
||||
if( append )
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
CV_Error(CV_StsNotImplemented, "Appending data to compressed file is not implemented" );
|
||||
}
|
||||
isGZ = true;
|
||||
compression = dot_pos[3];
|
||||
if( compression )
|
||||
@ -2713,6 +2715,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
if( !fs->gzfile )
|
||||
goto _exit_;
|
||||
#else
|
||||
cvReleaseFileStorage( &fs );
|
||||
CV_Error(CV_StsNotImplemented, "There is no compressed file storage support in this configuration");
|
||||
#endif
|
||||
}
|
||||
@ -2765,7 +2768,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
if( 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_Assert( strlen(encoding) < 1000 );
|
||||
char buf[1100];
|
||||
@ -2783,7 +2789,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
int last_occurence = -1;
|
||||
xml_buf_size = MIN(xml_buf_size, int(file_size));
|
||||
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>
|
||||
for(;;)
|
||||
{
|
||||
@ -2801,8 +2807,12 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
ptr += strlen(substr);
|
||||
}
|
||||
}
|
||||
cvFree( &xml_buf );
|
||||
if( last_occurence < 0 )
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
CV_Error( CV_StsError, "Could not find </opencv_storage> in the end of file.\n" );
|
||||
}
|
||||
icvCloseFile( fs );
|
||||
fs->file = fopen( fs->filename, "r+t" );
|
||||
fseek( fs->file, last_occurence, SEEK_SET );
|
||||
@ -2876,10 +2886,18 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
|
||||
//mode = cvGetErrMode();
|
||||
//cvSetErrMode( CV_ErrModeSilent );
|
||||
if( fs->fmt == CV_STORAGE_FORMAT_XML )
|
||||
icvXMLParse( fs );
|
||||
else
|
||||
icvYMLParse( fs );
|
||||
try
|
||||
{
|
||||
if( fs->fmt == CV_STORAGE_FORMAT_XML )
|
||||
icvXMLParse( fs );
|
||||
else
|
||||
icvYMLParse( fs );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
throw;
|
||||
}
|
||||
//cvSetErrMode( mode );
|
||||
|
||||
// release resources that we do not need anymore
|
||||
@ -2904,7 +2922,6 @@ _exit_:
|
||||
}
|
||||
}
|
||||
|
||||
cvFree( &xml_buf );
|
||||
return fs;
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,15 @@ void CvCapture_FFMPEG::close()
|
||||
}
|
||||
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
if( video_st )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user