mirror of
https://github.com/opencv/opencv.git
synced 2026-07-24 04:43:04 +04:00
Compare commits
108 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e40becab1 | |||
| 60eda6f25c | |||
| 2e78a3e5e9 | |||
| 966d35a9fb | |||
| 42447a7610 | |||
| ca50969c2b | |||
| 2d3e170370 | |||
| 8a37fc8223 | |||
| a5c20f8592 | |||
| 96a2edb375 | |||
| 15b313ce4b | |||
| 1ea6568951 | |||
| 56654ae360 | |||
| 9a3e53e738 | |||
| 2243bfa181 | |||
| 33cd7f38a8 | |||
| 2fc0ce5c24 | |||
| c5d009d6c4 | |||
| 7d28541bbe | |||
| e6f3f3c029 | |||
| 7746d9b7cc | |||
| 3494d640df | |||
| c22cc67ba8 | |||
| 558054a53d | |||
| c7b471f10f | |||
| f4ffcae8d9 | |||
| 0422054aa1 | |||
| a81f0a5123 | |||
| c36582d2df | |||
| d50c07e303 | |||
| 54693b3fa7 | |||
| 3c3bc123fc | |||
| ac33cd688c | |||
| b5e42d8cc1 | |||
| 7e4e8921bc | |||
| 6dcd455ac4 | |||
| 1d58e1a14a | |||
| d122510c4f | |||
| 6613d14261 | |||
| a14e524b32 | |||
| 226ff93917 | |||
| d28e6c9b36 | |||
| c16f465ff5 | |||
| 3231c2f995 | |||
| 16bcc30e42 | |||
| 69c50e0181 | |||
| 486c40f578 | |||
| 08e38e9ff9 | |||
| ba3b902da7 | |||
| bf94e6a91c | |||
| ecc53dd7a4 | |||
| fc0e0239b8 | |||
| d0210f510e | |||
| 34aa4e4578 | |||
| 447b8bf58a | |||
| e9539061db | |||
| ba7bf1ef68 | |||
| 5a53f41622 | |||
| 80844fd554 | |||
| a96a6bf149 | |||
| b7c9aaa471 | |||
| 00d9f690f6 | |||
| ae79fe10dc | |||
| 62fc342d35 | |||
| 36924d6dbb | |||
| e49e75da06 | |||
| 1d40946959 | |||
| 2598392295 | |||
| 17cc5e2c40 | |||
| 4b14400976 | |||
| 4704a254f7 | |||
| 7708e9882e | |||
| fe1bd0cc2f | |||
| a752f25944 | |||
| a984da911b | |||
| df55be3c3d | |||
| 55339de684 | |||
| f08dd510fa | |||
| d308ed3712 | |||
| 6d0f8aa893 | |||
| bea98bd22a | |||
| 4539607ab1 | |||
| b320138dba | |||
| 95ea12588e | |||
| bcd08b5d18 | |||
| 19298ae3cb | |||
| 5e06da3050 | |||
| 17ac18a7b9 | |||
| c259590b26 | |||
| 3f3ca85103 | |||
| 05ddc16eaa | |||
| 2ba77614aa | |||
| ef347aa6a4 | |||
| b1cdb91139 | |||
| a09ad35d98 | |||
| 1b5835cd35 | |||
| 9932bbad3a | |||
| 39ac84ff04 | |||
| fcbefaff86 | |||
| bf2256fb89 | |||
| b0b2fc9e3f | |||
| 1ccd64e102 | |||
| 23bf3e337a | |||
| 3cf265992f | |||
| 67635c6d65 | |||
| a26e496d00 | |||
| d579d3e596 | |||
| 5a77176654 |
@@ -1,8 +1,51 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*****************************************************************************************************
|
||||
USAGE:
|
||||
./opencv_annotation -images <folder location> -annotations <ouput file>
|
||||
|
||||
Created by: Puttemans Steven
|
||||
Created by: Puttemans Steven - February 2015
|
||||
*****************************************************************************************************/
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
@@ -12,6 +55,12 @@ Created by: Puttemans Steven
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
@@ -176,8 +225,33 @@ int main( int argc, const char** argv )
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the folder actually exists
|
||||
// If -1 is returned then the folder actually exists, and thus you can continue
|
||||
// In all other cases there was a folder creation and thus the folder did not exist
|
||||
#if defined(_WIN32)
|
||||
if(_mkdir(image_folder.c_str()) != -1){
|
||||
// Generate an error message
|
||||
cerr << "The image folder given does not exist. Please check again!" << endl;
|
||||
// Remove the created folder again, to ensure a second run with same code fails again
|
||||
_rmdir(image_folder.c_str());
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
if(mkdir(image_folder.c_str(), 0777) != -1){
|
||||
// Generate an error message
|
||||
cerr << "The image folder given does not exist. Please check again!" << endl;
|
||||
// Remove the created folder again, to ensure a second run with same code fails again
|
||||
remove(image_folder.c_str());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create the outputfilestream
|
||||
ofstream output(annotations.c_str());
|
||||
if ( !output.is_open() ){
|
||||
cerr << "The path for the output file contains an error and could not be opened. Please check again!" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Return the image filenames inside the image folder
|
||||
vector<String> filenames;
|
||||
@@ -191,6 +265,12 @@ int main( int argc, const char** argv )
|
||||
// Read in an image
|
||||
Mat current_image = imread(filenames[i]);
|
||||
|
||||
// Check if the image is actually read - avoid other files in the folder, because glob() takes them all
|
||||
// If not then simply skip this iteration
|
||||
if(current_image.empty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
// Perform annotations & generate corresponding output
|
||||
stringstream output_stream;
|
||||
get_annotations(current_image, &output_stream);
|
||||
|
||||
@@ -8,7 +8,8 @@ if(BUILD_ZLIB)
|
||||
else()
|
||||
include(FindZLIB)
|
||||
if(ZLIB_FOUND AND ANDROID)
|
||||
if(ZLIB_LIBRARY STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so")
|
||||
if(ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so" OR
|
||||
ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib64/libz.so")
|
||||
set(ZLIB_LIBRARY z)
|
||||
set(ZLIB_LIBRARIES z)
|
||||
endif()
|
||||
|
||||
@@ -12,8 +12,8 @@ endif(WITH_VFW)
|
||||
|
||||
# --- GStreamer ---
|
||||
ocv_clear_vars(HAVE_GSTREAMER)
|
||||
# try to find gstreamer 1.x first
|
||||
if(WITH_GSTREAMER)
|
||||
# try to find gstreamer 1.x first if 0.10 was not requested
|
||||
if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
|
||||
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
|
||||
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
|
||||
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
|
||||
@@ -29,7 +29,7 @@ if(WITH_GSTREAMER)
|
||||
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
|
||||
endif()
|
||||
|
||||
endif(WITH_GSTREAMER)
|
||||
endif()
|
||||
|
||||
# gstreamer support was requested but could not find gstreamer 1.x,
|
||||
# so fallback/try to find gstreamer 0.10
|
||||
|
||||
@@ -49,6 +49,8 @@ foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MOD
|
||||
if(HAVE_${mod})
|
||||
unset(HAVE_${mod} CACHE)
|
||||
endif()
|
||||
unset(OPENCV_MODULE_${mod}_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_DEPS_EXT CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_REQ_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_PRIVATE_REQ_DEPS CACHE)
|
||||
@@ -488,7 +490,7 @@ macro(ocv_glob_module_sources)
|
||||
|
||||
file(GLOB_RECURSE lib_srcs "src/*.cpp")
|
||||
file(GLOB_RECURSE lib_int_hdrs "src/*.hpp" "src/*.h")
|
||||
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
|
||||
file(GLOB_RECURSE lib_srcs_apple "src/*.mm")
|
||||
if (APPLE)
|
||||
@@ -574,7 +576,10 @@ macro(ocv_create_module)
|
||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
set(extra_deps ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
ocv_extract_simple_libs(extra_deps _simple_deps _other_deps)
|
||||
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${_simple_deps}) # this list goes to "export"
|
||||
target_link_libraries(${the_module} ${extra_deps})
|
||||
endif()
|
||||
|
||||
add_dependencies(opencv_modules ${the_module})
|
||||
@@ -629,7 +634,7 @@ macro(ocv_create_module)
|
||||
if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
|
||||
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
|
||||
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
|
||||
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
|
||||
if(hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$")
|
||||
install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -19,6 +19,7 @@ OpenCV makes it easy for businesses to utilize and modify the code.")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
|
||||
set(OPENCV_DEBIAN_COPYRIGHT_FILE "")
|
||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||
|
||||
set(CPACK_STRIP_FILES 1)
|
||||
@@ -115,15 +116,18 @@ if(HAVE_TBB AND NOT BUILD_TBB)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(STD_OPENCV_LIBS opencv-data libopencv-calib3d2.4 libopencv-contrib2.4 libopencv-core2.4
|
||||
libopencv-features2d2.4 libopencv-flann2.4 libopencv-gpu2.4 libopencv-imgproc2.4
|
||||
libopencv-ml2.4 libopencv-ocl2.4 libopencv-stitching2.4 libopencv-ts2.4 libopencv-videostab2.4)
|
||||
set(STD_OPENCV_LIBS opencv-data)
|
||||
set(STD_OPENCV_DEV libopencv-dev)
|
||||
|
||||
set(STD_OPENCV_DEV libopencv-calib3d-dev libopencv-contrib-dev libopencv-core-dev
|
||||
libopencv-dev libopencv-features2d-dev libopencv-flann-dev libopencv-gpu-dev
|
||||
libopencv-highgui-dev libopencv-imgproc-dev libopencv-legacy-dev libopencv-ml-dev
|
||||
libopencv-objdetect-dev libopencv-ocl-dev libopencv-photo-dev libopencv-stitching-dev
|
||||
libopencv-superres-dev libopencv-ts-dev libopencv-video-dev libopencv-videostab-dev)
|
||||
foreach(module calib3d contrib core features2d flann gpu highgui imgproc legacy
|
||||
ml objdetect ocl photo stitching superres ts video videostab)
|
||||
if(HAVE_opencv_${module})
|
||||
list(APPEND STD_OPENCV_LIBS "libopencv-${module}2.4")
|
||||
list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND STD_OPENCV_DEV "libhighgui-dev" "libcv-dev" "libcvaux-dev")
|
||||
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_CONFLICTS "${STD_OPENCV_LIBS}")
|
||||
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_PROVIDES "${STD_OPENCV_LIBS}")
|
||||
@@ -191,7 +195,7 @@ if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
set(DEBIAN_CHANGELOG_OUT_FILE "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.Debian")
|
||||
set(DEBIAN_CHANGELOG_OUT_FILE_GZ "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.Debian.gz")
|
||||
set(CHANGELOG_PACKAGE_NAME "${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/changelog.Debian.in" "${DEBIAN_CHANGELOG_OUT_FILE}" @ONLY)
|
||||
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/changelog.Debian.in" "${DEBIAN_CHANGELOG_OUT_FILE}" @ONLY)
|
||||
|
||||
execute_process(COMMAND "${GZIP_TOOL}" "-cf9" "${DEBIAN_CHANGELOG_OUT_FILE}"
|
||||
OUTPUT_FILE "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
||||
@@ -200,6 +204,25 @@ if(CPACK_GENERATOR STREQUAL "DEB")
|
||||
install(FILES "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
||||
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
||||
COMPONENT "${comp}")
|
||||
|
||||
set(CHANGELOG_OUT_FILE "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog")
|
||||
set(CHANGELOG_OUT_FILE_GZ "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.gz")
|
||||
file(WRITE ${CHANGELOG_OUT_FILE} "Upstream changelog stub. See https://github.com/Itseez/opencv/wiki/ChangeLog")
|
||||
|
||||
execute_process(COMMAND "${GZIP_TOOL}" "-cf9" "${CHANGELOG_OUT_FILE}"
|
||||
OUTPUT_FILE "${CHANGELOG_OUT_FILE_GZ}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
install(FILES "${CHANGELOG_OUT_FILE_GZ}"
|
||||
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
||||
COMPONENT "${comp}")
|
||||
|
||||
if(OPENCV_DEBIAN_COPYRIGHT_FILE)
|
||||
install(FILES "${OPENCV_DEBIAN_COPYRIGHT_FILE}"
|
||||
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
||||
COMPONENT "${comp}")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -630,3 +630,21 @@ function(ocv_source_group group)
|
||||
file(GLOB srcs ${OCV_SOURCE_GROUP_GLOB})
|
||||
source_group(${group} FILES ${srcs})
|
||||
endfunction()
|
||||
|
||||
# build the list of simple dependencies, that links via "-l"
|
||||
# _all_libs - name of variable with input list
|
||||
# _simple - name of variable with output list of simple libs
|
||||
# _other - name of variable with _all_libs - _simple
|
||||
macro(ocv_extract_simple_libs _all_libs _simple _other)
|
||||
set(${_simple} "")
|
||||
set(${_other} "")
|
||||
foreach(_l ${${_all_libs}})
|
||||
if(TARGET ${_l})
|
||||
list(APPEND ${_other} ${_l})
|
||||
elseif(EXISTS "${_l}")
|
||||
list(APPEND ${_other} ${_l})
|
||||
else()
|
||||
list(APPEND ${_simple} ${_l})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@CHANGELOG_PACKAGE_NAME@ (@CPACK_PACKAGE_VERSION@) unstable; urgency=low
|
||||
* Debian changelog stub. See upstream changelog or release notes in user
|
||||
* Debian changelog stub. See https://github.com/Itseez/opencv/wiki/ChangeLog
|
||||
or release notes in user
|
||||
documentation for more details.
|
||||
-- @CPACK_PACKAGE_CONTACT@ @CHANGELOG_PACKAGE_DATE@
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
Format: http://dep.debian.net/deps/dep5
|
||||
|
||||
Files: *
|
||||
Copyright: 2000-2015, Intel Corporation
|
||||
2009-2011, Willow Garage Inc.
|
||||
2009-2015, NVIDIA Corporation
|
||||
2010-2013, Advanced Micro Devices, Inc.
|
||||
2015, OpenCV Foundation
|
||||
2015, Itseez Inc.
|
||||
License: BSD-3-clause
|
||||
By downloading, copying, installing or using the software you agree to this
|
||||
license. If you do not agree to this license, do not download, install, copy
|
||||
or use the software.
|
||||
.
|
||||
.
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
.
|
||||
\* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
.
|
||||
\* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
.
|
||||
\* Neither the names of the copyright holders nor the names of the
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
This software is provided by the copyright holders and contributors "as is"
|
||||
and any express or implied warranties, including, but not limited to, the
|
||||
implied warranties of merchantability and fitness for a particular purpose are
|
||||
disclaimed. In no event shall copyright holders or contributors be liable for
|
||||
any direct, indirect, incidental, special, exemplary, or consequential damages
|
||||
(including, but not limited to, procurement of substitute goods or services;
|
||||
loss of use, data, or profits; or business interruption) however caused
|
||||
and on any theory of liability, whether in contract, strict liability,
|
||||
or tort (including negligence or otherwise) arising in any way out of
|
||||
the use of this software, even if advised of the possibility of such damage.
|
||||
@@ -1,3 +1,45 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
* //
|
||||
* // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
* //
|
||||
* // By downloading, copying, installing or using the software you agree to this license.
|
||||
* // If you do not agree to this license, do not download, install,
|
||||
* // copy or use the software.
|
||||
* //
|
||||
* //
|
||||
* // License Agreement
|
||||
* // For Open Source Computer Vision Library
|
||||
* //
|
||||
* // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
* // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
* // Third party copyrights are property of their respective owners.
|
||||
* //
|
||||
* // Redistribution and use in source and binary forms, with or without modification,
|
||||
* // are permitted provided that the following conditions are met:
|
||||
* //
|
||||
* // * Redistribution's of source code must retain the above copyright notice,
|
||||
* // this list of conditions and the following disclaimer.
|
||||
* //
|
||||
* // * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
* // this list of conditions and the following disclaimer in the documentation
|
||||
* // and/or other materials provided with the distribution.
|
||||
* //
|
||||
* // * The name of the copyright holders may not be used to endorse or promote products
|
||||
* // derived from this software without specific prior written permission.
|
||||
* //
|
||||
* // This software is provided by the copyright holders and contributors "as is" and
|
||||
* // any express or implied warranties, including, but not limited to, the implied
|
||||
* // warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
* // In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
* // indirect, incidental, special, exemplary, or consequential damages
|
||||
* // (including, but not limited to, procurement of substitute goods or services;
|
||||
* // loss of use, data, or profits; or business interruption) however caused
|
||||
* // and on any theory of liability, whether in contract, strict liability,
|
||||
* // or tort (including negligence or otherwise) arising in any way out of
|
||||
* // the use of this software, even if advised of the possibility of such damage.
|
||||
* //
|
||||
* //M*/
|
||||
|
||||
#ifndef __OPENCV_OLD_CXMISC_H__
|
||||
#define __OPENCV_OLD_CXMISC_H__
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ struct CvCBQuad
|
||||
//static CvMat* debug_img = 0;
|
||||
|
||||
static int icvGenerateQuads( CvCBQuad **quads, CvCBCorner **corners,
|
||||
CvMemStorage *storage, CvMat *image, int flags );
|
||||
CvMemStorage *storage, CvMat *image, int flags, int *max_quad_buf_size);
|
||||
|
||||
/*static int
|
||||
icvGenerateQuadsEx( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
||||
@@ -172,7 +172,7 @@ static int icvCleanFoundConnectedQuads( int quad_count,
|
||||
|
||||
static int icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
|
||||
CvSize pattern_size, CvMemStorage* storage );
|
||||
CvSize pattern_size, int max_quad_buf_size, CvMemStorage* storage );
|
||||
|
||||
static void icvOrderQuad(CvCBQuad *quad, CvCBCorner *corner, int common);
|
||||
|
||||
@@ -183,7 +183,7 @@ static int icvTrimRow(CvCBQuad **quads, int count, int row, int dir);
|
||||
#endif
|
||||
|
||||
static int icvAddOuterQuad(CvCBQuad *quad, CvCBQuad **quads, int quad_count,
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners);
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners, int max_quad_buf_size);
|
||||
|
||||
static void icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0);
|
||||
|
||||
@@ -313,6 +313,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
// making it difficult to detect smaller squares.
|
||||
for( k = 0; k < 6; k++ )
|
||||
{
|
||||
int max_quad_buf_size = 0;
|
||||
for( dilations = min_dilations; dilations <= max_dilations; dilations++ )
|
||||
{
|
||||
if (found)
|
||||
@@ -368,7 +369,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
cvRectangle( thresh_img, cvPoint(0,0), cvPoint(thresh_img->cols-1,
|
||||
thresh_img->rows-1), CV_RGB(255,255,255), 3, 8);
|
||||
|
||||
quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags );
|
||||
quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags, &max_quad_buf_size);
|
||||
|
||||
PRINTF("Quad count: %d/%d\n", quad_count, expected_corners_num);
|
||||
}
|
||||
@@ -408,8 +409,8 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
// allocate extra for adding in icvOrderFoundQuads
|
||||
cvFree(&quad_group);
|
||||
cvFree(&corner_group);
|
||||
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * (quad_count+quad_count / 2));
|
||||
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * (quad_count+quad_count / 2)*4 );
|
||||
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * max_quad_buf_size);
|
||||
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * max_quad_buf_size * 4 );
|
||||
|
||||
for( group_idx = 0; ; group_idx++ )
|
||||
{
|
||||
@@ -424,7 +425,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
||||
// maybe delete or add some
|
||||
PRINTF("Starting ordering of inner quads\n");
|
||||
count = icvOrderFoundConnectedQuads(count, quad_group, &quad_count, &quads, &corners,
|
||||
pattern_size, storage );
|
||||
pattern_size, max_quad_buf_size, storage );
|
||||
PRINTF("Orig count: %d After ordering: %d\n", icount, count);
|
||||
|
||||
|
||||
@@ -623,7 +624,7 @@ icvCheckBoardMonotony( CvPoint2D32f* corners, CvSize pattern_size )
|
||||
static int
|
||||
icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
|
||||
CvSize pattern_size, CvMemStorage* storage )
|
||||
CvSize pattern_size, int max_quad_buf_size, CvMemStorage* storage )
|
||||
{
|
||||
cv::Ptr<CvMemStorage> temp_storage = cvCreateChildMemStorage( storage );
|
||||
CvSeq* stack = cvCreateSeq( 0, sizeof(*stack), sizeof(void*), temp_storage );
|
||||
@@ -803,15 +804,18 @@ icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
if (found > 0)
|
||||
{
|
||||
PRINTF("Found %d inner quads not connected to outer quads, repairing\n", found);
|
||||
for (int i=0; i<quad_count; i++)
|
||||
for (int i=0; i<quad_count && *all_count < max_quad_buf_size; i++)
|
||||
{
|
||||
if (quads[i]->count < 4 && quads[i]->ordered)
|
||||
{
|
||||
int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners);
|
||||
int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners, max_quad_buf_size);
|
||||
*all_count += added;
|
||||
quad_count += added;
|
||||
}
|
||||
}
|
||||
|
||||
if (*all_count >= max_quad_buf_size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -854,11 +858,11 @@ icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||
|
||||
static int
|
||||
icvAddOuterQuad( CvCBQuad *quad, CvCBQuad **quads, int quad_count,
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners )
|
||||
CvCBQuad **all_quads, int all_count, CvCBCorner **corners, int max_quad_buf_size )
|
||||
|
||||
{
|
||||
int added = 0;
|
||||
for (int i=0; i<4; i++) // find no-neighbor corners
|
||||
for (int i=0; i<4 && all_count < max_quad_buf_size; i++) // find no-neighbor corners
|
||||
{
|
||||
if (!quad->neighbors[i]) // ok, create and add neighbor
|
||||
{
|
||||
@@ -1649,7 +1653,7 @@ static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count )
|
||||
|
||||
static int
|
||||
icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
||||
CvMemStorage *storage, CvMat *image, int flags )
|
||||
CvMemStorage *storage, CvMat *image, int flags, int *max_quad_buf_size )
|
||||
{
|
||||
int quad_count = 0;
|
||||
cv::Ptr<CvMemStorage> temp_storage;
|
||||
@@ -1754,8 +1758,9 @@ icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
||||
cvEndFindContours( &scanner );
|
||||
|
||||
// allocate quad & corner buffers
|
||||
*out_quads = (CvCBQuad*)cvAlloc((root->total+root->total / 2) * sizeof((*out_quads)[0]));
|
||||
*out_corners = (CvCBCorner*)cvAlloc((root->total+root->total / 2) * 4 * sizeof((*out_corners)[0]));
|
||||
*max_quad_buf_size = MAX(1, (root->total+root->total / 2)) * 2;
|
||||
*out_quads = (CvCBQuad*)cvAlloc(*max_quad_buf_size * sizeof((*out_quads)[0]));
|
||||
*out_corners = (CvCBCorner*)cvAlloc(*max_quad_buf_size * 4 * sizeof((*out_corners)[0]));
|
||||
|
||||
// Create array of quads structures
|
||||
for( idx = 0; idx < root->total; idx++ )
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2015, Itseez Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -562,6 +563,9 @@ void CV_HomographyTest::run(int)
|
||||
default: continue;
|
||||
}
|
||||
}
|
||||
|
||||
delete[]src_data;
|
||||
src_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/*! \file core.hpp
|
||||
\brief The Core Functionality
|
||||
*/
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/*! \file core.hpp
|
||||
\brief The Core Functionality
|
||||
*/
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define CV_VERSION_EPOCH 2
|
||||
#define CV_VERSION_MAJOR 4
|
||||
#define CV_VERSION_MINOR 12
|
||||
#define CV_VERSION_REVISION 0
|
||||
#define CV_VERSION_REVISION 2
|
||||
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
|
||||
@@ -346,6 +346,7 @@ CV_IMPL CvString
|
||||
cvMemStorageAllocString( CvMemStorage* storage, const char* ptr, int len )
|
||||
{
|
||||
CvString str;
|
||||
memset(&str, 0, sizeof(CvString));
|
||||
|
||||
str.len = len >= 0 ? len : (int)strlen(ptr);
|
||||
str.ptr = (char*)cvMemStorageAlloc( storage, str.len + 1 );
|
||||
@@ -1688,6 +1689,9 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice )
|
||||
|
||||
slice.end_index = slice.start_index + length;
|
||||
|
||||
if ( slice.start_index == slice.end_index )
|
||||
return;
|
||||
|
||||
if( slice.end_index < total )
|
||||
{
|
||||
CvSeqReader reader_to, reader_from;
|
||||
|
||||
@@ -2216,6 +2216,7 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
|
||||
Mat p = pts.getMat(manyContours ? i : -1);
|
||||
if( p.total() == 0 )
|
||||
{
|
||||
ptsptr[i] = NULL;
|
||||
npts[i] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -493,6 +493,7 @@ class Core_SeqBaseTest : public Core_DynStructBaseTest
|
||||
{
|
||||
public:
|
||||
Core_SeqBaseTest();
|
||||
virtual ~Core_SeqBaseTest();
|
||||
void clear();
|
||||
void run( int );
|
||||
|
||||
@@ -503,11 +504,14 @@ protected:
|
||||
int test_seq_ops( int iters );
|
||||
};
|
||||
|
||||
|
||||
Core_SeqBaseTest::Core_SeqBaseTest()
|
||||
{
|
||||
}
|
||||
|
||||
Core_SeqBaseTest::~Core_SeqBaseTest()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void Core_SeqBaseTest::clear()
|
||||
{
|
||||
@@ -1208,6 +1212,7 @@ class Core_SetTest : public Core_DynStructBaseTest
|
||||
{
|
||||
public:
|
||||
Core_SetTest();
|
||||
virtual ~Core_SetTest();
|
||||
void clear();
|
||||
void run( int );
|
||||
|
||||
@@ -1221,6 +1226,10 @@ Core_SetTest::Core_SetTest()
|
||||
{
|
||||
}
|
||||
|
||||
Core_SetTest::~Core_SetTest()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void Core_SetTest::clear()
|
||||
{
|
||||
@@ -1419,6 +1428,7 @@ class Core_GraphTest : public Core_DynStructBaseTest
|
||||
{
|
||||
public:
|
||||
Core_GraphTest();
|
||||
virtual ~Core_GraphTest();
|
||||
void clear();
|
||||
void run( int );
|
||||
|
||||
@@ -1432,6 +1442,10 @@ Core_GraphTest::Core_GraphTest()
|
||||
{
|
||||
}
|
||||
|
||||
Core_GraphTest::~Core_GraphTest()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void Core_GraphTest::clear()
|
||||
{
|
||||
@@ -2044,6 +2058,8 @@ void Core_GraphScanTest::run( int )
|
||||
CV_TS_SEQ_CHECK_CONDITION( vtx_count == 0 && edge_count == 0,
|
||||
"Not every vertex/edge has been visited" );
|
||||
update_progressbar();
|
||||
|
||||
cvReleaseGraphScanner( &scanner );
|
||||
}
|
||||
|
||||
// for a random graph the test just checks that every graph vertex and
|
||||
@@ -2108,8 +2124,6 @@ void Core_GraphScanTest::run( int )
|
||||
catch(int)
|
||||
{
|
||||
}
|
||||
|
||||
cvReleaseGraphScanner( &scanner );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ static void writeMatInBin( const Mat& mat, const string& filename )
|
||||
fwrite( (void*)&mat.rows, sizeof(int), 1, f );
|
||||
fwrite( (void*)&mat.cols, sizeof(int), 1, f );
|
||||
fwrite( (void*)&type, sizeof(int), 1, f );
|
||||
int dataSize = (int)(mat.step * mat.rows * mat.channels());
|
||||
int dataSize = (int)(mat.step * mat.rows);
|
||||
fwrite( (void*)&dataSize, sizeof(int), 1, f );
|
||||
fwrite( (void*)mat.data, 1, dataSize, f );
|
||||
fclose(f);
|
||||
@@ -80,12 +80,15 @@ static Mat readMatFromBin( const string& filename )
|
||||
size_t elements_read4 = fread( (void*)&dataSize, sizeof(int), 1, f );
|
||||
CV_Assert(elements_read1 == 1 && elements_read2 == 1 && elements_read3 == 1 && elements_read4 == 1);
|
||||
|
||||
uchar* data = (uchar*)cvAlloc(dataSize);
|
||||
size_t elements_read = fread( (void*)data, 1, dataSize, f );
|
||||
Mat returnMat(rows, cols, type);
|
||||
CV_Assert(returnMat.step * returnMat.rows == (size_t)(dataSize));
|
||||
|
||||
size_t elements_read = fread( (void*)returnMat.data, 1, dataSize, f );
|
||||
CV_Assert(elements_read == (size_t)(dataSize));
|
||||
|
||||
fclose(f);
|
||||
|
||||
return Mat( rows, cols, type, data );
|
||||
return returnMat;
|
||||
}
|
||||
return Mat();
|
||||
}
|
||||
|
||||
@@ -303,7 +303,8 @@ public:
|
||||
//
|
||||
// constructor
|
||||
//
|
||||
CV_FeatureDetectorMatcherBaseTest(testparam* _tp, double _accuracy_margin, cv::Feature2D* _fe, cv::DescriptorMatcher *_flmatcher, string _flmatchername, int norm_type_for_bfmatcher) :
|
||||
CV_FeatureDetectorMatcherBaseTest(testparam* _tp, double _accuracy_margin, cv::Feature2D* _fe,
|
||||
cv::DescriptorMatcher *_flmatcher, string _flmatchername, int norm_type_for_bfmatcher) :
|
||||
tp(_tp),
|
||||
target_accuracy_margin_from_bfmatcher(_accuracy_margin),
|
||||
fe(_fe),
|
||||
@@ -318,6 +319,15 @@ public:
|
||||
bfmatcher = new cv::BFMatcher(norm_type_for_bfmatcher);
|
||||
}
|
||||
|
||||
virtual ~CV_FeatureDetectorMatcherBaseTest()
|
||||
{
|
||||
if (bfmatcher)
|
||||
{
|
||||
delete bfmatcher;
|
||||
bfmatcher = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Main Test method
|
||||
//
|
||||
|
||||
@@ -65,13 +65,13 @@ protected:
|
||||
virtual void run( int start_from );
|
||||
virtual void createModel( const Mat& data ) = 0;
|
||||
virtual int findNeighbors( Mat& points, Mat& neighbors ) = 0;
|
||||
virtual int checkGetPoins( const Mat& data );
|
||||
virtual int checkGetPoints( const Mat& data );
|
||||
virtual int checkFindBoxed();
|
||||
virtual int checkFind( const Mat& data );
|
||||
virtual void releaseModel() = 0;
|
||||
};
|
||||
|
||||
int NearestNeighborTest::checkGetPoins( const Mat& )
|
||||
int NearestNeighborTest::checkGetPoints( const Mat& )
|
||||
{
|
||||
return cvtest::TS::OK;
|
||||
}
|
||||
@@ -125,11 +125,11 @@ int NearestNeighborTest::checkFind( const Mat& data )
|
||||
void NearestNeighborTest::run( int /*start_from*/ ) {
|
||||
int code = cvtest::TS::OK, tempCode;
|
||||
Mat desc( featuresCount, dims, CV_32FC1 );
|
||||
randu( desc, Scalar(minValue), Scalar(maxValue) );
|
||||
ts->get_rng().fill( desc, RNG::UNIFORM, minValue, maxValue );
|
||||
|
||||
createModel( desc );
|
||||
|
||||
tempCode = checkGetPoins( desc );
|
||||
tempCode = checkGetPoints( desc );
|
||||
if( tempCode != cvtest::TS::OK )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "bad accuracy of GetPoints \n" );
|
||||
@@ -159,10 +159,10 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
|
||||
class CV_KDTreeTest_CPP : public NearestNeighborTest
|
||||
{
|
||||
public:
|
||||
CV_KDTreeTest_CPP() {}
|
||||
CV_KDTreeTest_CPP() : NearestNeighborTest(), tr(NULL) {}
|
||||
protected:
|
||||
virtual void createModel( const Mat& data );
|
||||
virtual int checkGetPoins( const Mat& data );
|
||||
virtual int checkGetPoints( const Mat& data );
|
||||
virtual int findNeighbors( Mat& points, Mat& neighbors );
|
||||
virtual int checkFindBoxed();
|
||||
virtual void releaseModel();
|
||||
@@ -175,7 +175,7 @@ void CV_KDTreeTest_CPP::createModel( const Mat& data )
|
||||
tr = new KDTree( data, false );
|
||||
}
|
||||
|
||||
int CV_KDTreeTest_CPP::checkGetPoins( const Mat& data )
|
||||
int CV_KDTreeTest_CPP::checkGetPoints( const Mat& data )
|
||||
{
|
||||
Mat res1( data.size(), data.type() ),
|
||||
res3( data.size(), data.type() );
|
||||
@@ -244,7 +244,7 @@ void CV_KDTreeTest_CPP::releaseModel()
|
||||
class CV_FlannTest : public NearestNeighborTest
|
||||
{
|
||||
public:
|
||||
CV_FlannTest() {}
|
||||
CV_FlannTest() : NearestNeighborTest(), index(NULL) { }
|
||||
protected:
|
||||
void createIndex( const Mat& data, const IndexParams& params );
|
||||
int knnSearch( Mat& points, Mat& neighbors );
|
||||
@@ -255,6 +255,9 @@ protected:
|
||||
|
||||
void CV_FlannTest::createIndex( const Mat& data, const IndexParams& params )
|
||||
{
|
||||
// release previously allocated index
|
||||
releaseModel();
|
||||
|
||||
index = new Index( data, params );
|
||||
}
|
||||
|
||||
@@ -321,7 +324,11 @@ int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
|
||||
|
||||
void CV_FlannTest::releaseModel()
|
||||
{
|
||||
delete index;
|
||||
if (index)
|
||||
{
|
||||
delete index;
|
||||
index = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
/***********************************************************************
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
|
||||
* Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
|
||||
*
|
||||
* THE BSD LICENSE
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef OPENCV_FLANN_DUMMY_H_
|
||||
#define OPENCV_FLANN_DUMMY_H_
|
||||
|
||||
@@ -384,6 +384,8 @@ public:
|
||||
}
|
||||
|
||||
root_ = pool_.allocate<KMeansNode>();
|
||||
std::memset(root_, 0, sizeof(KMeansNode));
|
||||
|
||||
computeNodeStatistics(root_, indices_, (int)size_);
|
||||
computeClustering(root_, indices_, (int)size_, branching_,0);
|
||||
}
|
||||
@@ -823,11 +825,11 @@ private:
|
||||
variance -= distance_(centers[c], ZeroIterator<ElementType>(), veclen_);
|
||||
|
||||
node->childs[c] = pool_.allocate<KMeansNode>();
|
||||
std::memset(node->childs[c], 0, sizeof(KMeansNode));
|
||||
node->childs[c]->radius = radiuses[c];
|
||||
node->childs[c]->pivot = centers[c];
|
||||
node->childs[c]->variance = variance;
|
||||
node->childs[c]->mean_radius = mean_radius;
|
||||
node->childs[c]->indices = NULL;
|
||||
computeClustering(node->childs[c],indices+start, end-start, branching, level+1);
|
||||
start=end;
|
||||
}
|
||||
|
||||
@@ -318,12 +318,14 @@ buildIndex_(void*& index, const Mat& wholedata, const Mat& data, const IndexPara
|
||||
|
||||
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
|
||||
|
||||
IndexType* _index = NULL;
|
||||
if( !index || getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR) != FLANN_INDEX_LSH) // currently, additional index support is the lsh algorithm only.
|
||||
// currently, additional index support is the lsh algorithm only.
|
||||
if( !index || getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR) != FLANN_INDEX_LSH)
|
||||
{
|
||||
_index = new IndexType(dataset, get_params(params), dist);
|
||||
Ptr<IndexType> _index = makePtr<IndexType>(dataset, get_params(params), dist);
|
||||
_index->buildIndex();
|
||||
index = _index;
|
||||
// HACK to prevent object destruction
|
||||
_index.obj = NULL;
|
||||
}
|
||||
else // build additional lsh index
|
||||
{
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace cv { namespace gpu { namespace device
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename T>
|
||||
__global__ void data_step_down(int dst_cols, int dst_rows, int src_rows, const PtrStep<T> src, PtrStep<T> dst)
|
||||
__global__ void data_step_down(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStep<T> src, PtrStep<T> dst)
|
||||
{
|
||||
const int x = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
const int y = blockIdx.y * blockDim.y + threadIdx.y;
|
||||
@@ -264,10 +264,10 @@ namespace cv { namespace gpu { namespace device
|
||||
{
|
||||
for (int d = 0; d < cndisp; ++d)
|
||||
{
|
||||
float dst_reg = src.ptr(d * src_rows + (2*y+0))[(2*x+0)];
|
||||
dst_reg += src.ptr(d * src_rows + (2*y+1))[(2*x+0)];
|
||||
dst_reg += src.ptr(d * src_rows + (2*y+0))[(2*x+1)];
|
||||
dst_reg += src.ptr(d * src_rows + (2*y+1))[(2*x+1)];
|
||||
float dst_reg = src.ptr(d * src_rows + ::min(2*y+0, src_rows-1))[::min(2*x+0, src_cols-1)];
|
||||
dst_reg += src.ptr(d * src_rows + ::min(2*y+1, src_rows-1))[::min(2*x+0, src_cols-1)];
|
||||
dst_reg += src.ptr(d * src_rows + ::min(2*y+0, src_rows-1))[::min(2*x+1, src_cols-1)];
|
||||
dst_reg += src.ptr(d * src_rows + ::min(2*y+1, src_rows-1))[::min(2*x+1, src_cols-1)];
|
||||
|
||||
dst.ptr(d * dst_rows + y)[x] = saturate_cast<T>(dst_reg);
|
||||
}
|
||||
@@ -275,7 +275,7 @@ namespace cv { namespace gpu { namespace device
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void data_step_down_gpu(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream)
|
||||
void data_step_down_gpu(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream)
|
||||
{
|
||||
dim3 threads(32, 8, 1);
|
||||
dim3 grid(1, 1, 1);
|
||||
@@ -283,15 +283,15 @@ namespace cv { namespace gpu { namespace device
|
||||
grid.x = divUp(dst_cols, threads.x);
|
||||
grid.y = divUp(dst_rows, threads.y);
|
||||
|
||||
data_step_down<T><<<grid, threads, 0, stream>>>(dst_cols, dst_rows, src_rows, (PtrStepSz<T>)src, (PtrStepSz<T>)dst);
|
||||
data_step_down<T><<<grid, threads, 0, stream>>>(dst_cols, dst_rows, src_cols, src_rows, (PtrStepSz<T>)src, (PtrStepSz<T>)dst);
|
||||
cudaSafeCall( cudaGetLastError() );
|
||||
|
||||
if (stream == 0)
|
||||
cudaSafeCall( cudaDeviceSynchronize() );
|
||||
}
|
||||
|
||||
template void data_step_down_gpu<short>(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
template void data_step_down_gpu<float>(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
template void data_step_down_gpu<short>(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
template void data_step_down_gpu<float>(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
/////////////////// level up messages ////////////////////////
|
||||
|
||||
@@ -2804,7 +2804,7 @@ void cv::gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, St
|
||||
}
|
||||
else
|
||||
{
|
||||
const int elem_size = src.elemSize1();
|
||||
const int elem_size = static_cast<int>(src.elemSize1());
|
||||
const int num_channels = src.channels();
|
||||
const int bcols = src.cols * num_channels;
|
||||
|
||||
@@ -2895,7 +2895,7 @@ void cv::gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c
|
||||
}
|
||||
else
|
||||
{
|
||||
const int elem_size = src1.elemSize1();
|
||||
const int elem_size = static_cast<int>(src1.elemSize1());
|
||||
const int num_channels = src1.channels();
|
||||
const int bcols = src1.cols * num_channels;
|
||||
|
||||
@@ -2979,7 +2979,7 @@ void cv::gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, co
|
||||
}
|
||||
else
|
||||
{
|
||||
const int elem_size = src1.elemSize1();
|
||||
const int elem_size = static_cast<int>(src1.elemSize1());
|
||||
const int num_channels = src1.channels();
|
||||
const int bcols = src1.cols * num_channels;
|
||||
|
||||
@@ -3063,7 +3063,7 @@ void cv::gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c
|
||||
}
|
||||
else
|
||||
{
|
||||
const int elem_size = src1.elemSize1();
|
||||
const int elem_size = static_cast<int>(src1.elemSize1());
|
||||
const int num_channels = src1.channels();
|
||||
const int bcols = src1.cols * num_channels;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace cv { namespace gpu { namespace device
|
||||
template<typename T, typename D>
|
||||
void comp_data_gpu(const PtrStepSzb& left, const PtrStepSzb& right, const PtrStepSzb& data, cudaStream_t stream);
|
||||
template<typename T>
|
||||
void data_step_down_gpu(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
void data_step_down_gpu(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
template <typename T>
|
||||
void level_up_messages_gpu(int dst_idx, int dst_cols, int dst_rows, int src_rows, PtrStepSzb* mus, PtrStepSzb* mds, PtrStepSzb* mls, PtrStepSzb* mrs, cudaStream_t stream);
|
||||
template <typename T>
|
||||
@@ -158,7 +158,7 @@ namespace
|
||||
|
||||
init(stream);
|
||||
|
||||
datas[0].create(rows * rthis.ndisp, cols, rthis.msg_type);
|
||||
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, datas[0]);
|
||||
|
||||
comp_data_callers[rthis.msg_type == CV_32F][left.channels()](left, right, datas[0], StreamAccessor::getStream(stream));
|
||||
|
||||
@@ -187,10 +187,10 @@ namespace
|
||||
private:
|
||||
void init(Stream& stream)
|
||||
{
|
||||
u.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
||||
d.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
||||
l.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
||||
r.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
||||
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, u);
|
||||
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, d);
|
||||
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, l);
|
||||
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, r);
|
||||
|
||||
if (rthis.levels & 1)
|
||||
{
|
||||
@@ -216,10 +216,10 @@ namespace
|
||||
int less_rows = (rows + 1) / 2;
|
||||
int less_cols = (cols + 1) / 2;
|
||||
|
||||
u2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
||||
d2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
||||
l2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
||||
r2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
||||
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, u2);
|
||||
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, d2);
|
||||
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, l2);
|
||||
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, r2);
|
||||
|
||||
if ((rthis.levels & 1) == 0)
|
||||
{
|
||||
@@ -253,7 +253,7 @@ namespace
|
||||
|
||||
void calcBP(GpuMat& disp, Stream& stream)
|
||||
{
|
||||
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
|
||||
static const data_step_down_t data_step_down_callers[2] =
|
||||
{
|
||||
data_step_down_gpu<short>, data_step_down_gpu<float>
|
||||
@@ -286,9 +286,9 @@ namespace
|
||||
cols_all[i] = (cols_all[i-1] + 1) / 2;
|
||||
rows_all[i] = (rows_all[i-1] + 1) / 2;
|
||||
|
||||
datas[i].create(rows_all[i] * rthis.ndisp, cols_all[i], rthis.msg_type);
|
||||
createContinuous(rows_all[i] * rthis.ndisp, cols_all[i], rthis.msg_type, datas[i]);
|
||||
|
||||
data_step_down_callers[funcIdx](cols_all[i], rows_all[i], rows_all[i-1], datas[i-1], datas[i], cudaStream);
|
||||
data_step_down_callers[funcIdx](cols_all[i], rows_all[i], cols_all[i-1], rows_all[i-1], datas[i-1], datas[i], cudaStream);
|
||||
}
|
||||
|
||||
PtrStepSzb mus[] = {u, u2};
|
||||
|
||||
@@ -114,7 +114,9 @@ GPU_TEST_P(StereoBeliefPropagation, Regression)
|
||||
cv::Mat h_disp(disp);
|
||||
h_disp.convertTo(h_disp, disp_gold.depth());
|
||||
|
||||
EXPECT_MAT_NEAR(disp_gold, h_disp, 0.0);
|
||||
cv::Rect roi(0, 0, disp_gold.cols - 20, disp_gold.rows - 20);
|
||||
|
||||
EXPECT_MAT_NEAR(disp_gold(roi), h_disp(roi), 0.0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_Calib3D, StereoBeliefPropagation, ALL_DEVICES);
|
||||
|
||||
@@ -64,7 +64,7 @@ set(highgui_srcs
|
||||
src/window.cpp
|
||||
)
|
||||
|
||||
file(GLOB highgui_ext_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB highgui_ext_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
|
||||
if(HAVE_QT5)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
@@ -238,10 +238,12 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, 0);
|
||||
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2,
|
||||
reinterpret_cast<char *>(index));
|
||||
if (capture)
|
||||
return capture;
|
||||
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L, 0);
|
||||
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L,
|
||||
reinterpret_cast<char *>(index));
|
||||
if (capture)
|
||||
return capture;
|
||||
#endif
|
||||
|
||||
@@ -75,10 +75,13 @@
|
||||
|
||||
#if GST_VERSION_MAJOR == 0
|
||||
#define COLOR_ELEM "ffmpegcolorspace"
|
||||
#define COLOR_ELEM_NAME "ffmpegcsp"
|
||||
#elif FULL_GST_VERSION < VERSION_NUM(1,5,0)
|
||||
#define COLOR_ELEM "videoconvert"
|
||||
#define COLOR_ELEM_NAME COLOR_ELEM
|
||||
#else
|
||||
#define COLOR_ELEM "autovideoconvert"
|
||||
#define COLOR_ELEM_NAME COLOR_ELEM
|
||||
#endif
|
||||
|
||||
void toFraction(double decimal, double &numerator, double &denominator);
|
||||
@@ -142,6 +145,7 @@ protected:
|
||||
gpointer data);
|
||||
GstElement* pipeline;
|
||||
GstElement* uridecodebin;
|
||||
GstElement* v4l2src;
|
||||
GstElement* color;
|
||||
GstElement* sink;
|
||||
#if GST_VERSION_MAJOR > 0
|
||||
@@ -165,6 +169,7 @@ void CvCapture_GStreamer::init()
|
||||
{
|
||||
pipeline = NULL;
|
||||
uridecodebin = NULL;
|
||||
v4l2src = NULL;
|
||||
color = NULL;
|
||||
sink = NULL;
|
||||
#if GST_VERSION_MAJOR > 0
|
||||
@@ -371,9 +376,7 @@ void CvCapture_GStreamer::startPipeline()
|
||||
if (status == GST_STATE_CHANGE_ASYNC)
|
||||
{
|
||||
// wait for status update
|
||||
GstState st1;
|
||||
GstState st2;
|
||||
status = gst_element_get_state(pipeline, &st1, &st2, GST_CLOCK_TIME_NONE);
|
||||
status = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
||||
}
|
||||
if (status == GST_STATE_CHANGE_FAILURE)
|
||||
{
|
||||
@@ -568,21 +571,39 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
GstElementFactory * testfac;
|
||||
GstStateChangeReturn status;
|
||||
|
||||
if (type == CV_CAP_GSTREAMER_V4L){
|
||||
int cameraID = -1;
|
||||
if (type == CV_CAP_GSTREAMER_V4L ||
|
||||
type == CV_CAP_GSTREAMER_V4L2)
|
||||
{
|
||||
cameraID = static_cast<int>(reinterpret_cast<intptr_t>(filename));
|
||||
}
|
||||
|
||||
std::stringstream stdstream;
|
||||
std::string stdfilename;
|
||||
|
||||
if (type == CV_CAP_GSTREAMER_V4L)
|
||||
{
|
||||
testfac = gst_element_factory_find("v4lsrc");
|
||||
if (!testfac){
|
||||
return false;
|
||||
}
|
||||
g_object_unref(G_OBJECT(testfac));
|
||||
filename = "v4lsrc ! "COLOR_ELEM" ! appsink";
|
||||
|
||||
stdstream << "v4lsrc device=/dev/video" << cameraID << " ! " << COLOR_ELEM << " ! appsink";
|
||||
stdfilename = stdstream.str();
|
||||
filename = stdfilename.c_str();
|
||||
}
|
||||
if (type == CV_CAP_GSTREAMER_V4L2){
|
||||
else if (type == CV_CAP_GSTREAMER_V4L2)
|
||||
{
|
||||
testfac = gst_element_factory_find("v4l2src");
|
||||
if (!testfac){
|
||||
return false;
|
||||
}
|
||||
g_object_unref(G_OBJECT(testfac));
|
||||
filename = "v4l2src ! "COLOR_ELEM" ! appsink";
|
||||
|
||||
stdstream << "v4l2src device=/dev/video" << cameraID << " ! " << COLOR_ELEM << " ! appsink";
|
||||
stdfilename = stdstream.str();
|
||||
filename = stdfilename.c_str();
|
||||
}
|
||||
|
||||
|
||||
@@ -620,7 +641,9 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
stream = true;
|
||||
manualpipeline = true;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
stream = true;
|
||||
uri = g_strdup(filename);
|
||||
}
|
||||
@@ -641,68 +664,86 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
uridecodebin = gst_element_make_from_uri(GST_URI_SRC, uri, "src", NULL);
|
||||
#endif
|
||||
element_from_uri = true;
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
uridecodebin = gst_element_factory_make("uridecodebin", NULL);
|
||||
g_object_set(G_OBJECT(uridecodebin), "uri", uri, NULL);
|
||||
}
|
||||
g_free(protocol);
|
||||
|
||||
if(!uridecodebin) {
|
||||
if(!uridecodebin)
|
||||
{
|
||||
//fprintf(stderr, "GStreamer: Error opening bin: %s\n", err->message);
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(manualpipeline)
|
||||
if (manualpipeline)
|
||||
{
|
||||
GstIterator *it = NULL;
|
||||
#if GST_VERSION_MAJOR == 0
|
||||
it = gst_bin_iterate_sinks(GST_BIN(uridecodebin));
|
||||
if(gst_iterator_next(it, (gpointer *)&sink) != GST_ITERATOR_OK) {
|
||||
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
it = gst_bin_iterate_sinks (GST_BIN(uridecodebin));
|
||||
GstIterator *it = gst_bin_iterate_elements(GST_BIN(uridecodebin));
|
||||
|
||||
gboolean done = FALSE;
|
||||
GstElement *element = NULL;
|
||||
gboolean done = false;
|
||||
gchar* name = NULL;
|
||||
#if GST_VERSION_MAJOR > 0
|
||||
GValue value = G_VALUE_INIT;
|
||||
#endif
|
||||
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (it, &value)) {
|
||||
while (!done)
|
||||
{
|
||||
#if GST_VERSION_MAJOR > 0
|
||||
switch (gst_iterator_next (it, &value))
|
||||
{
|
||||
case GST_ITERATOR_OK:
|
||||
element = GST_ELEMENT (g_value_get_object (&value));
|
||||
name = gst_element_get_name(element);
|
||||
if (name){
|
||||
if(strstr(name, "opencvsink") != NULL || strstr(name, "appsink") != NULL) {
|
||||
sink = GST_ELEMENT ( gst_object_ref (element) );
|
||||
done = TRUE;
|
||||
}
|
||||
g_free(name);
|
||||
}
|
||||
g_value_unset (&value);
|
||||
element = GST_ELEMENT (g_value_get_object (&value));
|
||||
#else
|
||||
switch (gst_iterator_next (it, (gpointer *)&element))
|
||||
{
|
||||
case GST_ITERATOR_OK:
|
||||
#endif
|
||||
name = gst_element_get_name(element);
|
||||
if (name)
|
||||
{
|
||||
if (strstr(name, "opencvsink") != NULL || strstr(name, "appsink") != NULL)
|
||||
{
|
||||
sink = GST_ELEMENT ( gst_object_ref (element) );
|
||||
}
|
||||
else if (strstr(name, COLOR_ELEM_NAME) != NULL)
|
||||
{
|
||||
color = GST_ELEMENT ( gst_object_ref (element) );
|
||||
}
|
||||
else if (strstr(name, "v4l") != NULL)
|
||||
{
|
||||
v4l2src = GST_ELEMENT ( gst_object_ref (element) );
|
||||
}
|
||||
g_free(name);
|
||||
|
||||
break;
|
||||
done = sink && color && v4l2src;
|
||||
}
|
||||
#if GST_VERSION_MAJOR > 0
|
||||
g_value_unset (&value);
|
||||
#endif
|
||||
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
gst_iterator_resync (it);
|
||||
break;
|
||||
gst_iterator_resync (it);
|
||||
break;
|
||||
case GST_ITERATOR_ERROR:
|
||||
case GST_ITERATOR_DONE:
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gst_iterator_free (it);
|
||||
|
||||
|
||||
if (!sink){
|
||||
if (!sink)
|
||||
{
|
||||
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
pipeline = uridecodebin;
|
||||
}
|
||||
else
|
||||
@@ -715,18 +756,23 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
|
||||
gst_bin_add_many(GST_BIN(pipeline), uridecodebin, color, sink, NULL);
|
||||
|
||||
if(element_from_uri) {
|
||||
if(!gst_element_link(uridecodebin, color)) {
|
||||
if(element_from_uri)
|
||||
{
|
||||
if(!gst_element_link(uridecodebin, color))
|
||||
{
|
||||
CV_ERROR(CV_StsError, "GStreamer: cannot link color -> sink\n");
|
||||
gst_object_unref(pipeline);
|
||||
pipeline = NULL;
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
g_signal_connect(uridecodebin, "pad-added", G_CALLBACK(newPad), color);
|
||||
}
|
||||
|
||||
if(!gst_element_link(color, sink)) {
|
||||
if(!gst_element_link(color, sink))
|
||||
{
|
||||
CV_ERROR(CV_StsError, "GStreamer: cannot link color -> sink\n");
|
||||
gst_object_unref(pipeline);
|
||||
pipeline = NULL;
|
||||
@@ -754,16 +800,13 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
|
||||
gst_caps_unref(caps);
|
||||
|
||||
// For video files only: set pipeline to PAUSED state to get its duration
|
||||
if (file)
|
||||
{
|
||||
status = gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PAUSED);
|
||||
status = gst_element_set_state(GST_ELEMENT(pipeline),
|
||||
file ? GST_STATE_PAUSED : GST_STATE_PLAYING);
|
||||
if (status == GST_STATE_CHANGE_ASYNC)
|
||||
{
|
||||
// wait for status update
|
||||
GstState st1;
|
||||
GstState st2;
|
||||
status = gst_element_get_state(pipeline, &st1, &st2, GST_CLOCK_TIME_NONE);
|
||||
status = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
||||
}
|
||||
if (status == GST_STATE_CHANGE_FAILURE)
|
||||
{
|
||||
@@ -814,14 +857,9 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
|
||||
fps = (double)num/(double)denom;
|
||||
|
||||
// GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");
|
||||
}
|
||||
else
|
||||
{
|
||||
duration = -1;
|
||||
width = -1;
|
||||
height = -1;
|
||||
fps = -1;
|
||||
// GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline")
|
||||
|
||||
stopPipeline();
|
||||
}
|
||||
|
||||
__END__;
|
||||
@@ -852,7 +890,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
||||
|
||||
if(!pipeline) {
|
||||
CV_WARN("GStreamer: no pipeline");
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(propId) {
|
||||
@@ -861,7 +899,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
||||
status = gst_element_query_position(sink, FORMAT, &value);
|
||||
if(!status) {
|
||||
CV_WARN("GStreamer: unable to query position of stream");
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
return value * 1e-6; // nano seconds to milli seconds
|
||||
case CV_CAP_PROP_POS_FRAMES:
|
||||
@@ -869,7 +907,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
||||
status = gst_element_query_position(sink, FORMAT, &value);
|
||||
if(!status) {
|
||||
CV_WARN("GStreamer: unable to query position of stream");
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
return value;
|
||||
case CV_CAP_PROP_POS_AVI_RATIO:
|
||||
@@ -877,7 +915,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
||||
status = gst_element_query_position(sink, FORMAT, &value);
|
||||
if(!status) {
|
||||
CV_WARN("GStreamer: unable to query position of stream");
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
return ((double) value) / GST_FORMAT_PERCENT_MAX;
|
||||
case CV_CAP_PROP_FRAME_WIDTH:
|
||||
@@ -896,6 +934,21 @@ double CvCapture_GStreamer::getProperty( int propId )
|
||||
case CV_CAP_PROP_CONTRAST:
|
||||
case CV_CAP_PROP_SATURATION:
|
||||
case CV_CAP_PROP_HUE:
|
||||
if (v4l2src)
|
||||
{
|
||||
const gchar * propName =
|
||||
propId == CV_CAP_PROP_BRIGHTNESS ? "brightness" :
|
||||
propId == CV_CAP_PROP_CONTRAST ? "contrast" :
|
||||
propId == CV_CAP_PROP_SATURATION ? "saturation" :
|
||||
propId == CV_CAP_PROP_HUE ? "hue" : NULL;
|
||||
|
||||
if (propName)
|
||||
{
|
||||
gint32 value32 = 0;
|
||||
g_object_get(G_OBJECT(v4l2src), propName, &value32, NULL);
|
||||
return value32;
|
||||
}
|
||||
}
|
||||
case CV_CAP_PROP_GAIN:
|
||||
case CV_CAP_PROP_CONVERT_RGB:
|
||||
break;
|
||||
@@ -912,7 +965,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
||||
|
||||
#undef FORMAT
|
||||
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -991,6 +1044,21 @@ bool CvCapture_GStreamer::setProperty( int propId, double value )
|
||||
case CV_CAP_PROP_CONTRAST:
|
||||
case CV_CAP_PROP_SATURATION:
|
||||
case CV_CAP_PROP_HUE:
|
||||
if (v4l2src)
|
||||
{
|
||||
const gchar * propName =
|
||||
propId == CV_CAP_PROP_BRIGHTNESS ? "brightness" :
|
||||
propId == CV_CAP_PROP_CONTRAST ? "contrast" :
|
||||
propId == CV_CAP_PROP_SATURATION ? "saturation" :
|
||||
propId == CV_CAP_PROP_HUE ? "hue" : NULL;
|
||||
|
||||
if (propName)
|
||||
{
|
||||
gint32 value32 = cv::saturate_cast<gint32>(value);
|
||||
g_object_set(G_OBJECT(v4l2src), propName, &value32, NULL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
case CV_CAP_PROP_GAIN:
|
||||
case CV_CAP_PROP_CONVERT_RGB:
|
||||
break;
|
||||
|
||||
@@ -221,7 +221,12 @@ bool TiffDecoder::readData( Mat& img )
|
||||
(!is_tiled && tile_height0 == std::numeric_limits<uint32>::max()) )
|
||||
tile_height0 = m_height;
|
||||
|
||||
const size_t buffer_size = bpp * ncn * tile_height0 * tile_width0;
|
||||
if(dst_bpp == 8) {
|
||||
// we will use TIFFReadRGBA* functions, so allocate temporary buffer for 32bit RGBA
|
||||
bpp = 8;
|
||||
ncn = 4;
|
||||
}
|
||||
const size_t buffer_size = (bpp/bitsPerByte) * ncn * tile_height0 * tile_width0;
|
||||
AutoBuffer<uchar> _buffer( buffer_size );
|
||||
uchar* buffer = _buffer;
|
||||
ushort* buffer16 = (ushort*)buffer;
|
||||
|
||||
@@ -396,6 +396,10 @@ TEST(Highgui_Video_parallel_writers_and_readers, accuracy)
|
||||
if (code == 1)
|
||||
std::cerr << "Couldn't delete " << *i << std::endl;
|
||||
}
|
||||
|
||||
// delete the readers
|
||||
for (std::vector<VideoCapture *>::iterator i = readers.begin(), end = readers.end(); i != end; ++i)
|
||||
delete *i;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*! \file imgproc.hpp
|
||||
\brief The Image Processing
|
||||
*/
|
||||
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*! \file imgproc.hpp
|
||||
\brief The Image Processing
|
||||
*/
|
||||
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
|
||||
@@ -548,7 +548,7 @@ void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter*
|
||||
|
||||
struct ConversionYUV
|
||||
{
|
||||
ConversionYUV( const int code )
|
||||
explicit ConversionYUV( const int code )
|
||||
{
|
||||
yuvReader_ = YUVreader :: getReader(code);
|
||||
yuvWriter_ = YUVwriter :: getWriter(code);
|
||||
@@ -557,6 +557,24 @@ struct ConversionYUV
|
||||
grayWriter_ = GRAYwriter:: getWriter(code);
|
||||
}
|
||||
|
||||
~ConversionYUV()
|
||||
{
|
||||
if (yuvReader_)
|
||||
delete yuvReader_;
|
||||
|
||||
if (yuvWriter_)
|
||||
delete yuvWriter_;
|
||||
|
||||
if (rgbReader_)
|
||||
delete rgbReader_;
|
||||
|
||||
if (rgbWriter_)
|
||||
delete rgbWriter_;
|
||||
|
||||
if (grayWriter_)
|
||||
delete grayWriter_;
|
||||
}
|
||||
|
||||
int getDcn()
|
||||
{
|
||||
return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());
|
||||
|
||||
@@ -501,6 +501,8 @@ _exit_:
|
||||
comp[6] = s1;
|
||||
comp[7] = s2;
|
||||
comp[8] = 0;
|
||||
|
||||
cvReleaseMemStorage(&st);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1372,17 +1372,65 @@ void CV_GetQuadSubPixTest::prepare_to_validation( int /*test_case_idx*/ )
|
||||
dst.convertTo(dst0, dst0.depth());
|
||||
}
|
||||
|
||||
////////////////////////////// resizeArea /////////////////////////////////
|
||||
|
||||
template <typename T>
|
||||
static void check_resize_area(const Mat& expected, const Mat& actual, double tolerance = 1.0)
|
||||
{
|
||||
ASSERT_EQ(actual.type(), expected.type());
|
||||
ASSERT_EQ(actual.size(), expected.size());
|
||||
|
||||
Mat diff;
|
||||
absdiff(actual, expected, diff);
|
||||
|
||||
Mat one_channel_diff = diff; //.reshape(1);
|
||||
|
||||
Size dsize = actual.size();
|
||||
bool next = true;
|
||||
for (int dy = 0; dy < dsize.height && next; ++dy)
|
||||
{
|
||||
const T* eD = expected.ptr<T>(dy);
|
||||
const T* aD = actual.ptr<T>(dy);
|
||||
|
||||
for (int dx = 0; dx < dsize.width && next; ++dx)
|
||||
if (fabs(static_cast<double>(aD[dx] - eD[dx])) > tolerance)
|
||||
{
|
||||
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Inf norm: %f\n", static_cast<float>(norm(actual, expected, NORM_INF)));
|
||||
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Error in : (%d, %d)\n", dx, dy);
|
||||
|
||||
const int radius = 3;
|
||||
int rmin = MAX(dy - radius, 0), rmax = MIN(dy + radius, dsize.height);
|
||||
int cmin = MAX(dx - radius, 0), cmax = MIN(dx + radius, dsize.width);
|
||||
|
||||
std::cout << "Abs diff:" << std::endl << diff << std::endl;
|
||||
std::cout << "actual result:\n" << actual(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
|
||||
std::cout << "expected result:\n" << expected(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
|
||||
|
||||
next = false;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(norm(one_channel_diff, cv::NORM_INF), 0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(Imgproc_cvWarpAffine, regression)
|
||||
{
|
||||
IplImage* src = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
|
||||
IplImage* dst = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
|
||||
|
||||
cvZero(src);
|
||||
|
||||
float m[6];
|
||||
CvMat M = cvMat( 2, 3, CV_32F, m );
|
||||
int w = src->width;
|
||||
int h = src->height;
|
||||
cv2DRotationMatrix(cvPoint2D32f(w*0.5f, h*0.5f), 45.0, 1.0, &M);
|
||||
cvWarpAffine(src, dst, &M);
|
||||
|
||||
cvReleaseImage(&src);
|
||||
cvReleaseImage(&dst);
|
||||
}
|
||||
|
||||
TEST(Imgproc_fitLine_vector_3d, regression)
|
||||
@@ -1496,41 +1544,45 @@ TEST(Imgproc_resize_area, regression)
|
||||
|
||||
cv::resize(src, actual, cv::Size(), 0.3, 0.3, INTER_AREA);
|
||||
|
||||
ASSERT_EQ(actual.type(), expected.type());
|
||||
ASSERT_EQ(actual.size(), expected.size());
|
||||
check_resize_area<ushort>(expected, actual, 1.0);
|
||||
}
|
||||
|
||||
Mat diff;
|
||||
absdiff(actual, expected, diff);
|
||||
TEST(Imgproc_resize_area, regression_half_round)
|
||||
{
|
||||
static uchar input_data[32 * 32];
|
||||
for(int i = 0; i < 32 * 32; ++i)
|
||||
input_data[i] = (uchar)(i % 2 + 253 + i / (16 * 32));
|
||||
|
||||
Mat one_channel_diff = diff; //.reshape(1);
|
||||
static uchar expected_data[16 * 16];
|
||||
for(int i = 0; i < 16 * 16; ++i)
|
||||
expected_data[i] = (uchar)(254 + i / (16 * 8));
|
||||
|
||||
float elem_diff = 1.0f;
|
||||
Size dsize = actual.size();
|
||||
bool next = true;
|
||||
for (int dy = 0; dy < dsize.height && next; ++dy)
|
||||
{
|
||||
ushort* eD = expected.ptr<ushort>(dy);
|
||||
ushort* aD = actual.ptr<ushort>(dy);
|
||||
cv::Mat src(32, 32, CV_8UC1, input_data);
|
||||
cv::Mat expected(16, 16, CV_8UC1, expected_data);
|
||||
cv::Mat actual(expected.size(), expected.type());
|
||||
|
||||
for (int dx = 0; dx < dsize.width && next; ++dx)
|
||||
if (fabs(static_cast<float>(aD[dx] - eD[dx])) > elem_diff)
|
||||
{
|
||||
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Inf norm: %f\n", static_cast<float>(norm(actual, expected, NORM_INF)));
|
||||
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Error in : (%d, %d)\n", dx, dy);
|
||||
cv::resize(src, actual, cv::Size(), 0.5, 0.5, INTER_AREA);
|
||||
|
||||
const int radius = 3;
|
||||
int rmin = MAX(dy - radius, 0), rmax = MIN(dy + radius, dsize.height);
|
||||
int cmin = MAX(dx - radius, 0), cmax = MIN(dx + radius, dsize.width);
|
||||
check_resize_area<uchar>(expected, actual, 0.5);
|
||||
}
|
||||
|
||||
std::cout << "Abs diff:" << std::endl << diff << std::endl;
|
||||
std::cout << "actual result:\n" << actual(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
|
||||
std::cout << "expected result:\n" << expected(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
|
||||
TEST(Imgproc_resize_area, regression_quarter_round)
|
||||
{
|
||||
static uchar input_data[32 * 32];
|
||||
for(int i = 0; i < 32 * 32; ++i)
|
||||
input_data[i] = (uchar)(i % 2 + 253 + i / (16 * 32));
|
||||
|
||||
next = false;
|
||||
}
|
||||
}
|
||||
static uchar expected_data[8 * 8];
|
||||
for(int i = 0; i < 8 * 8; ++i)
|
||||
expected_data[i] = 254;
|
||||
|
||||
ASSERT_EQ(norm(one_channel_diff, cv::NORM_INF), 0);
|
||||
cv::Mat src(32, 32, CV_8UC1, input_data);
|
||||
cv::Mat expected(8, 8, CV_8UC1, expected_data);
|
||||
cv::Mat actual(expected.size(), expected.type());
|
||||
|
||||
cv::resize(src, actual, cv::Size(), 0.25, 0.25, INTER_AREA);
|
||||
|
||||
check_resize_area<uchar>(expected, actual, 0.5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -644,8 +644,7 @@ private:
|
||||
};
|
||||
|
||||
CV_Remap_Test::CV_Remap_Test() :
|
||||
CV_ImageWarpBaseTest(), mapx(), mapy(),
|
||||
borderType(-1), borderValue()
|
||||
CV_ImageWarpBaseTest(), borderType(-1)
|
||||
{
|
||||
funcs[0] = &CV_Remap_Test::remap_nearest;
|
||||
funcs[1] = &CV_Remap_Test::remap_generic;
|
||||
@@ -666,7 +665,7 @@ void CV_Remap_Test::generate_test_data()
|
||||
// generating the mapx, mapy matrices
|
||||
static const int mapx_types[] = { CV_16SC2, CV_32FC1, CV_32FC2 };
|
||||
mapx.create(dst.size(), mapx_types[rng.uniform(0, sizeof(mapx_types) / sizeof(int))]);
|
||||
mapy = Mat();
|
||||
mapy.release();
|
||||
|
||||
const int n = std::min(std::min(src.cols, src.rows) / 10 + 1, 2);
|
||||
float _n = 0; //static_cast<float>(-n);
|
||||
@@ -693,7 +692,7 @@ void CV_Remap_Test::generate_test_data()
|
||||
{
|
||||
MatIterator_<ushort> begin_y = mapy.begin<ushort>(), end_y = mapy.end<ushort>();
|
||||
for ( ; begin_y != end_y; ++begin_y)
|
||||
begin_y[0] = static_cast<short>(rng.uniform(0, 1024));
|
||||
*begin_y = static_cast<ushort>(rng.uniform(0, 1024));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -701,7 +700,7 @@ void CV_Remap_Test::generate_test_data()
|
||||
{
|
||||
MatIterator_<short> begin_y = mapy.begin<short>(), end_y = mapy.end<short>();
|
||||
for ( ; begin_y != end_y; ++begin_y)
|
||||
begin_y[0] = static_cast<short>(rng.uniform(0, 1024));
|
||||
*begin_y = static_cast<short>(rng.uniform(0, 1024));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -718,8 +717,8 @@ void CV_Remap_Test::generate_test_data()
|
||||
MatIterator_<float> begin_y = mapy.begin<float>();
|
||||
for ( ; begin_x != end_x; ++begin_x, ++begin_y)
|
||||
{
|
||||
begin_x[0] = rng.uniform(_n, fscols);
|
||||
begin_y[0] = rng.uniform(_n, fsrows);
|
||||
*begin_x = rng.uniform(_n, fscols);
|
||||
*begin_y = rng.uniform(_n, fsrows);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -731,8 +730,8 @@ void CV_Remap_Test::generate_test_data()
|
||||
fsrows = static_cast<float>(std::max(src.rows - 1 + n, 0));
|
||||
for ( ; begin_x != end_x; ++begin_x)
|
||||
{
|
||||
begin_x[0] = rng.uniform(_n, fscols);
|
||||
begin_x[1] = rng.uniform(_n, fsrows);
|
||||
(*begin_x)[0] = rng.uniform(_n, fscols);
|
||||
(*begin_x)[1] = rng.uniform(_n, fsrows);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -777,23 +776,6 @@ void CV_Remap_Test::prepare_test_data_for_reference_func()
|
||||
{
|
||||
CV_ImageWarpBaseTest::prepare_test_data_for_reference_func();
|
||||
convert_maps();
|
||||
/*
|
||||
const int ksize = 3;
|
||||
Mat kernel = getStructuringElement(CV_MOP_ERODE, Size(ksize, ksize));
|
||||
Mat mask(src.size(), CV_8UC1, Scalar::all(255)), dst_mask;
|
||||
cv::erode(src, erode_src, kernel);
|
||||
cv::erode(mask, dst_mask, kernel, Point(-1, -1), 1, BORDER_CONSTANT, Scalar::all(0));
|
||||
bitwise_not(dst_mask, mask);
|
||||
src.copyTo(erode_src, mask);
|
||||
dst_mask.release();
|
||||
|
||||
mask = Scalar::all(0);
|
||||
kernel = getStructuringElement(CV_MOP_DILATE, kernel.size());
|
||||
cv::dilate(src, dilate_src, kernel);
|
||||
cv::dilate(mask, dst_mask, kernel, Point(-1, -1), 1, BORDER_CONSTANT, Scalar::all(255));
|
||||
src.copyTo(dilate_src, dst_mask);
|
||||
dst_mask.release();
|
||||
*/
|
||||
}
|
||||
|
||||
void CV_Remap_Test::run_reference_func()
|
||||
|
||||
@@ -1535,6 +1535,10 @@ void CvANN_MLP::read( CvFileStorage* fs, CvFileNode* node )
|
||||
|
||||
_layer_sizes = (CvMat*)cvReadByName( fs, node, "layer_sizes" );
|
||||
CV_CALL( create( _layer_sizes, SIGMOID_SYM, 0, 0 ));
|
||||
|
||||
cvReleaseMat( &_layer_sizes );
|
||||
_layer_sizes = NULL;
|
||||
|
||||
l_count = layer_sizes->cols;
|
||||
|
||||
CV_CALL( read_params( fs, node ));
|
||||
|
||||
@@ -537,6 +537,9 @@ void CvERTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
|
||||
if( data )
|
||||
delete data;
|
||||
|
||||
if ( pair16u32s_ptr )
|
||||
cvFree( &pair16u32s_ptr );
|
||||
|
||||
if (_fdst)
|
||||
cvFree( &_fdst );
|
||||
if (_idst)
|
||||
|
||||
@@ -259,7 +259,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag,
|
||||
for (int i=1; i<n; ++i)
|
||||
{
|
||||
int k = 0;
|
||||
while ((int(orig_response->data.fl[i]) - class_labels->data.i[k]) && (k<j))
|
||||
while ((k<j) && (int(orig_response->data.fl[i]) - class_labels->data.i[k]))
|
||||
k++;
|
||||
if (k == j)
|
||||
{
|
||||
@@ -1292,13 +1292,18 @@ CvGBTrees::calc_error( CvMLData* _data, int type, std::vector<float> *resp )
|
||||
return -FLT_MAX;
|
||||
|
||||
float* pred_resp = 0;
|
||||
bool needsFreeing = false;
|
||||
|
||||
if (resp)
|
||||
{
|
||||
resp->resize(n);
|
||||
pred_resp = &((*resp)[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
pred_resp = new float[n];
|
||||
needsFreeing = true;
|
||||
}
|
||||
|
||||
Sample_predictor predictor = Sample_predictor(this, pred_resp, _data->get_values(),
|
||||
_data->get_missing(), _sample_idx);
|
||||
@@ -1331,6 +1336,9 @@ CvGBTrees::calc_error( CvMLData* _data, int type, std::vector<float> *resp )
|
||||
err = err / (float)n;
|
||||
}
|
||||
|
||||
if (needsFreeing)
|
||||
delete[]pred_resp;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -777,7 +777,8 @@ cvGetTrainSamples( const CvMat* train_data, int tflag,
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
int i, j, var_count, sample_count, s_step, v_step;
|
||||
int i, j, var_count, sample_count;
|
||||
size_t s_step, v_step, s;
|
||||
bool copy_data;
|
||||
const float* data;
|
||||
const int *s_idx, *v_idx;
|
||||
@@ -815,7 +816,7 @@ cvGetTrainSamples( const CvMat* train_data, int tflag,
|
||||
{
|
||||
samples[0] = (float*)(samples + sample_count);
|
||||
if( tflag != CV_ROW_SAMPLE )
|
||||
CV_SWAP( s_step, v_step, i );
|
||||
CV_SWAP( s_step, v_step, s );
|
||||
|
||||
for( i = 0; i < sample_count; i++ )
|
||||
{
|
||||
|
||||
@@ -2315,7 +2315,12 @@ void CvSVM::write( CvFileStorage* fs, const char* name ) const
|
||||
params.svm_type == CvSVM::ONE_CLASS ? 1 : 0;
|
||||
const CvSVMDecisionFunc* df = decision_func;
|
||||
if( !isSvmModelApplicable(sv_total, var_all, var_count, class_count) )
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
fs = NULL;
|
||||
|
||||
CV_ERROR( CV_StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" );
|
||||
}
|
||||
|
||||
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_SVM );
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ class NewOpenCVTests(unittest.TestCase):
|
||||
def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR):
|
||||
if not filename in self.image_cache:
|
||||
filedata = urllib.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
|
||||
self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
|
||||
image = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
|
||||
self.assertFalse(image is None)
|
||||
self.image_cache[filename] = image
|
||||
return self.image_cache[filename]
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -323,6 +323,7 @@ BadArgTest::BadArgTest()
|
||||
progress = -1;
|
||||
test_case_idx = -1;
|
||||
freq = cv::getTickFrequency();
|
||||
t = -1;
|
||||
// oldErrorCbk = 0;
|
||||
// oldErrorCbkData = 0;
|
||||
}
|
||||
@@ -338,6 +339,7 @@ int BadArgTest::run_test_case( int expected_code, const string& _descr )
|
||||
{
|
||||
test_case_idx = 0;
|
||||
progress = 0;
|
||||
t = 0;
|
||||
dt = 0;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -22,7 +22,7 @@ endif()
|
||||
if(INSTALL_C_EXAMPLES)
|
||||
install(FILES "CMakeLists.txt"
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||
endif()
|
||||
|
||||
if(INSTALL_PYTHON_EXAMPLES)
|
||||
@@ -68,8 +68,14 @@ endif()
|
||||
|
||||
add_subdirectory(c)
|
||||
add_subdirectory(cpp)
|
||||
add_subdirectory(ocl)
|
||||
add_subdirectory(gpu)
|
||||
ocv_check_dependencies(opencv_ocl)
|
||||
if (OCV_DEPENDENCIES_FOUND)
|
||||
add_subdirectory(ocl)
|
||||
endif()
|
||||
ocv_check_dependencies(opencv_gpu)
|
||||
if (OCV_DEPENDENCIES_FOUND)
|
||||
add_subdirectory(gpu)
|
||||
endif()
|
||||
|
||||
#
|
||||
# END OF BUILD CASE 2: Build samples with library binaries
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
SET(OPENCV_C_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc
|
||||
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo opencv_nonfree
|
||||
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo
|
||||
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib)
|
||||
|
||||
ocv_check_dependencies(${OPENCV_C_SAMPLES_REQUIRED_DEPS})
|
||||
@@ -16,7 +16,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
|
||||
endif()
|
||||
|
||||
ocv_include_modules(${OPENCV_C_SAMPLES_REQUIRED_DEPS})
|
||||
ocv_include_modules(${OPENCV_C_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
|
||||
|
||||
# ---------------------------------------------
|
||||
# Define executable targets
|
||||
@@ -52,8 +52,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
endif()
|
||||
|
||||
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
|
||||
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd *.txt)
|
||||
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* *.cmd *.txt)
|
||||
install(FILES ${C_SAMPLES}
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||
install(PROGRAMS build_all.sh DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c" COMPONENT samples)
|
||||
endif ()
|
||||
|
||||
+24
-10
@@ -4,19 +4,31 @@
|
||||
* Author: Liu Liu
|
||||
* liuliu.1987+opencv@gmail.com
|
||||
*/
|
||||
#include "opencv2/objdetect/objdetect.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#include "opencv2/imgproc/imgproc_c.h"
|
||||
#include "opencv2/legacy/legacy.hpp"
|
||||
#include "opencv2/legacy/compat.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/objdetect/objdetect.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/calib3d/calib3d.hpp"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
# include "opencv2/imgproc/imgproc_c.h"
|
||||
# include "opencv2/legacy/legacy.hpp"
|
||||
# include "opencv2/legacy/compat.hpp"
|
||||
|
||||
# include <vector>
|
||||
|
||||
using namespace std;
|
||||
static void help()
|
||||
{
|
||||
@@ -320,3 +332,5 @@ int main(int argc, char** argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,25 @@
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#include "opencv2/legacy/legacy.hpp"
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/core/core.hpp"
|
||||
# include "opencv2/imgproc/imgproc.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
# include "opencv2/legacy/legacy.hpp"
|
||||
|
||||
# include <iostream>
|
||||
# include <fstream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
@@ -164,3 +177,5 @@ int main( int argc, char **argv )
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,16 +7,28 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/imgproc/imgproc_c.h"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#include "opencv2/legacy/legacy.hpp"
|
||||
#include "opencv2/legacy/compat.hpp"
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/imgproc/imgproc.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/imgproc/imgproc_c.h"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
# include "opencv2/legacy/legacy.hpp"
|
||||
# include "opencv2/legacy/compat.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
|
||||
static void help()
|
||||
{
|
||||
@@ -116,3 +128,5 @@ Mat DrawCorrespondences(const Mat& img1, const vector<KeyPoint>& features1, cons
|
||||
|
||||
return img_corr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc
|
||||
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo opencv_nonfree
|
||||
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_stitching opencv_videostab)
|
||||
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo
|
||||
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib
|
||||
opencv_stitching opencv_videostab)
|
||||
|
||||
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
||||
|
||||
@@ -14,7 +15,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
project(cpp_samples)
|
||||
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/include")#for opencv.hpp
|
||||
ocv_include_modules(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
||||
ocv_include_modules(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
|
||||
|
||||
if(HAVE_opencv_gpu)
|
||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include")
|
||||
@@ -93,6 +94,6 @@ endif()
|
||||
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
|
||||
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd *.txt)
|
||||
install(FILES ${C_SAMPLES}
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||
endif()
|
||||
|
||||
@@ -1,29 +1,41 @@
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#include "opencv2/ml/ml.hpp"
|
||||
#ifdef HAVE_OPENCV_OCL
|
||||
#define _OCL_SVM_ 1 //select whether using ocl::svm method or not, default is using
|
||||
#include "opencv2/ocl/ocl.hpp"
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
#if defined WIN32 || defined _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef min
|
||||
#undef max
|
||||
#include "sys/types.h"
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
#define DEBUG_DESC_PROGRESS
|
||||
int main(int, char**)
|
||||
{
|
||||
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/imgproc/imgproc.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
# include "opencv2/ml/ml.hpp"
|
||||
# ifdef HAVE_OPENCV_OCL
|
||||
# define _OCL_SVM_ 1 //select whether using ocl::svm method or not, default is using
|
||||
# include "opencv2/ocl/ocl.hpp"
|
||||
# endif
|
||||
|
||||
# include <fstream>
|
||||
# include <memory>
|
||||
# include <functional>
|
||||
|
||||
|
||||
# if defined WIN32 || defined _WIN32
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# undef min
|
||||
# undef max
|
||||
# include "sys/types.h"
|
||||
# endif
|
||||
# include <sys/stat.h>
|
||||
|
||||
# define DEBUG_DESC_PROGRESS
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
@@ -2623,3 +2635,5 @@ int main(int argc, char** argv)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#ifdef HAVE_OPENCV_NONFREE
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -17,14 +20,14 @@ static void help(char** argv)
|
||||
<< "Case1: second image is obtained from the first (given) image using random generated homography matrix\n"
|
||||
<< argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image] [evaluate(0 or 1)]\n"
|
||||
<< "Example of case1:\n"
|
||||
<< "./descriptor_extractor_matcher SURF SURF FlannBased NoneFilter cola.jpg 0\n"
|
||||
<< "./descriptor_extractor_matcher ORB ORB FlannBased NoneFilter cola.jpg 0\n"
|
||||
<< "\n"
|
||||
<< "Case2: both images are given. If ransacReprojThreshold>=0 then homography matrix are calculated\n"
|
||||
<< argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image1] [image2] [ransacReprojThreshold]\n"
|
||||
<< "\n"
|
||||
<< "Matches are filtered using homography matrix in case1 and case2 (if ransacReprojThreshold>=0)\n"
|
||||
<< "Example of case2:\n"
|
||||
<< "./descriptor_extractor_matcher SURF SURF BruteForce CrossCheckFilter cola1.jpg cola2.jpg 3\n"
|
||||
<< "./descriptor_extractor_matcher ORB ORB BruteForce CrossCheckFilter cola1.jpg cola2.jpg 3\n"
|
||||
<< "\n"
|
||||
<< "Possible detectorType values: see in documentation on createFeatureDetector().\n"
|
||||
<< "Possible descriptorType values: see in documentation on createDescriptorExtractor().\n"
|
||||
@@ -239,7 +242,11 @@ int main(int argc, char** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCV_NONFREE
|
||||
cv::initModule_nonfree();
|
||||
#else
|
||||
cout << "Warning: OpenCV is built without nonfree support SIFT, SURF and some other algorithms are not available." << endl;
|
||||
#endif
|
||||
|
||||
bool isWarpPerspective = argc == 7;
|
||||
double ransacReprojThreshold = -1;
|
||||
|
||||
@@ -49,9 +49,21 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#include "opencv2/opencv.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/opencv.hpp"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
@@ -212,3 +224,5 @@ int main(int argc, char * argv[]) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,15 +34,27 @@
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#include <opencv2/nonfree/features2d.hpp>
|
||||
#include <opencv2/legacy/legacy.hpp>
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include <string>
|
||||
# include <vector>
|
||||
|
||||
# include <opencv2/core/core.hpp>
|
||||
# include <opencv2/highgui/highgui.hpp>
|
||||
# include <opencv2/features2d/features2d.hpp>
|
||||
# include <opencv2/nonfree/features2d.hpp>
|
||||
# include <opencv2/legacy/legacy.hpp>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
@@ -126,3 +138,5 @@ int main( int argc, char** argv ) {
|
||||
imshow("matches", imgMatch);
|
||||
waitKey(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/opencv_modules.hpp"
|
||||
# include "opencv2/calib3d/calib3d.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/imgproc/imgproc.hpp"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
static void help()
|
||||
@@ -91,3 +103,5 @@ Mat DrawCorrespondences(const Mat& img1, const vector<KeyPoint>& features1, cons
|
||||
|
||||
return img_corr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <stdio.h>
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/core/core.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
@@ -56,3 +68,5 @@ int main(int argc, char** argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,12 +4,23 @@
|
||||
* @author A. Huaman
|
||||
*/
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/core/core.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
@@ -28,7 +39,7 @@ int main( int argc, char** argv )
|
||||
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
|
||||
|
||||
if( !img_1.data || !img_2.data )
|
||||
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
|
||||
{ printf(" --(!) Error reading images \n"); return -1; }
|
||||
|
||||
//-- Step 1: Detect the keypoints using SURF Detector
|
||||
int minHessian = 400;
|
||||
@@ -97,4 +108,6 @@ int main( int argc, char** argv )
|
||||
* @function readme
|
||||
*/
|
||||
void readme()
|
||||
{ std::cout << " Usage: ./SURF_FlannMatcher <img1> <img2>" << std::endl; }
|
||||
{ printf(" Usage: ./SURF_FlannMatcher <img1> <img2>\n"); }
|
||||
|
||||
#endif
|
||||
@@ -4,13 +4,24 @@
|
||||
* @author A. Huaman
|
||||
*/
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/core/core.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/calib3d/calib3d.hpp"
|
||||
# include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
@@ -29,7 +40,7 @@ int main( int argc, char** argv )
|
||||
Mat img_scene = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
|
||||
|
||||
if( !img_object.data || !img_scene.data )
|
||||
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
|
||||
{ printf(" --(!) Error reading images \n"); return -1; }
|
||||
|
||||
//-- Step 1: Detect the keypoints using SURF Detector
|
||||
int minHessian = 400;
|
||||
@@ -121,4 +132,6 @@ int main( int argc, char** argv )
|
||||
* @function readme
|
||||
*/
|
||||
void readme()
|
||||
{ std::cout << " Usage: ./SURF_Homography <img1> <img2>" << std::endl; }
|
||||
{ printf(" Usage: ./SURF_Homography <img1> <img2>\n"); }
|
||||
|
||||
#endif
|
||||
@@ -4,12 +4,23 @@
|
||||
* @author A. Huaman
|
||||
*/
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/core/core.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
@@ -69,4 +80,6 @@ int main( int argc, char** argv )
|
||||
* @function readme
|
||||
*/
|
||||
void readme()
|
||||
{ std::cout << " Usage: ./SURF_descriptor <img1> <img2>" << std::endl; }
|
||||
{ printf(" Usage: ./SURF_descriptor <img1> <img2>\n"); }
|
||||
|
||||
#endif
|
||||
@@ -4,12 +4,23 @@
|
||||
* @author A. Huaman
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <iostream>
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/core/core.hpp"
|
||||
# include "opencv2/features2d/features2d.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/nonfree/features2d.hpp"
|
||||
|
||||
using namespace cv;
|
||||
|
||||
@@ -60,3 +71,5 @@ int main( int argc, char** argv )
|
||||
*/
|
||||
void readme()
|
||||
{ std::cout << " Usage: ./SURF_detector <img1> <img2>" << std::endl; }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -112,6 +112,6 @@ if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
|
||||
list_filterout(install_list ".*driver_api_stereo_multi.cpp")
|
||||
endif()
|
||||
install(FILES ${install_list}
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||
endif()
|
||||
|
||||
@@ -29,7 +29,7 @@ endif()
|
||||
if(INSTALL_C_EXAMPLES AND NOT WIN32)
|
||||
file(GLOB GPU_FILES performance/*.cpp performance/*.h performance/CMakeLists.txt)
|
||||
install(FILES ${GPU_FILES}
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu/performance
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
||||
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu/performance"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
COMPONENT samples)
|
||||
endif()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
SET(OPENCV_OCL_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui
|
||||
opencv_ml opencv_video opencv_objdetect opencv_features2d
|
||||
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl
|
||||
opencv_nonfree)
|
||||
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl)
|
||||
|
||||
ocv_check_dependencies(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
|
||||
|
||||
@@ -11,7 +10,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
|
||||
project("${project}_samples")
|
||||
|
||||
ocv_include_modules(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
|
||||
ocv_include_modules(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
|
||||
|
||||
if(HAVE_OPENCL)
|
||||
ocv_include_directories(${OPENCL_INCLUDE_DIR})
|
||||
@@ -52,8 +51,8 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
endif()
|
||||
|
||||
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
|
||||
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd *.txt)
|
||||
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* *.txt)
|
||||
install(FILES ${install_list}
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||
endif()
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/ocl/ocl.hpp"
|
||||
#include "opencv2/nonfree/ocl.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
#include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
#ifndef HAVE_OPENCV_NONFREE
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include "opencv2/core/core.hpp"
|
||||
# include "opencv2/highgui/highgui.hpp"
|
||||
# include "opencv2/ocl/ocl.hpp"
|
||||
# include "opencv2/nonfree/ocl.hpp"
|
||||
# include "opencv2/calib3d/calib3d.hpp"
|
||||
# include "opencv2/nonfree/nonfree.hpp"
|
||||
|
||||
using namespace cv;
|
||||
using namespace cv::ocl;
|
||||
@@ -326,3 +337,5 @@ int main(int argc, char* argv[])
|
||||
waitKey(0);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user