mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +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:
|
USAGE:
|
||||||
./opencv_annotation -images <folder location> -annotations <ouput file>
|
./opencv_annotation -images <folder location> -annotations <ouput file>
|
||||||
|
|
||||||
Created by: Puttemans Steven
|
Created by: Puttemans Steven - February 2015
|
||||||
*****************************************************************************************************/
|
*****************************************************************************************************/
|
||||||
|
|
||||||
#include <opencv2/core/core.hpp>
|
#include <opencv2/core/core.hpp>
|
||||||
@@ -12,6 +55,12 @@ Created by: Puttemans Steven
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <direct.h>
|
||||||
|
#else
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
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
|
// Create the outputfilestream
|
||||||
ofstream output(annotations.c_str());
|
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
|
// Return the image filenames inside the image folder
|
||||||
vector<String> filenames;
|
vector<String> filenames;
|
||||||
@@ -191,6 +265,12 @@ int main( int argc, const char** argv )
|
|||||||
// Read in an image
|
// Read in an image
|
||||||
Mat current_image = imread(filenames[i]);
|
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
|
// Perform annotations & generate corresponding output
|
||||||
stringstream output_stream;
|
stringstream output_stream;
|
||||||
get_annotations(current_image, &output_stream);
|
get_annotations(current_image, &output_stream);
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ if(BUILD_ZLIB)
|
|||||||
else()
|
else()
|
||||||
include(FindZLIB)
|
include(FindZLIB)
|
||||||
if(ZLIB_FOUND AND ANDROID)
|
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_LIBRARY z)
|
||||||
set(ZLIB_LIBRARIES z)
|
set(ZLIB_LIBRARIES z)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ endif(WITH_VFW)
|
|||||||
|
|
||||||
# --- GStreamer ---
|
# --- GStreamer ---
|
||||||
ocv_clear_vars(HAVE_GSTREAMER)
|
ocv_clear_vars(HAVE_GSTREAMER)
|
||||||
# try to find gstreamer 1.x first
|
# try to find gstreamer 1.x first if 0.10 was not requested
|
||||||
if(WITH_GSTREAMER)
|
if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
|
||||||
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
|
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
|
||||||
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
|
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
|
||||||
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
|
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})
|
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif(WITH_GSTREAMER)
|
endif()
|
||||||
|
|
||||||
# gstreamer support was requested but could not find gstreamer 1.x,
|
# gstreamer support was requested but could not find gstreamer 1.x,
|
||||||
# so fallback/try to find gstreamer 0.10
|
# 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})
|
if(HAVE_${mod})
|
||||||
unset(HAVE_${mod} CACHE)
|
unset(HAVE_${mod} CACHE)
|
||||||
endif()
|
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}_REQ_DEPS CACHE)
|
||||||
unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE)
|
unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE)
|
||||||
unset(OPENCV_MODULE_${mod}_PRIVATE_REQ_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_srcs "src/*.cpp")
|
||||||
file(GLOB_RECURSE lib_int_hdrs "src/*.hpp" "src/*.h")
|
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 lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
|
||||||
file(GLOB_RECURSE lib_srcs_apple "src/*.mm")
|
file(GLOB_RECURSE lib_srcs_apple "src/*.mm")
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
@@ -574,7 +576,10 @@ macro(ocv_create_module)
|
|||||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
|
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} 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()
|
endif()
|
||||||
|
|
||||||
add_dependencies(opencv_modules ${the_module})
|
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};")
|
if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
|
||||||
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
|
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
|
||||||
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
|
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)
|
install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
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_MINOR "${OPENCV_VERSION_MINOR}")
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
|
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
|
||||||
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
|
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
|
||||||
|
set(OPENCV_DEBIAN_COPYRIGHT_FILE "")
|
||||||
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
|
||||||
|
|
||||||
set(CPACK_STRIP_FILES 1)
|
set(CPACK_STRIP_FILES 1)
|
||||||
@@ -115,15 +116,18 @@ if(HAVE_TBB AND NOT BUILD_TBB)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(STD_OPENCV_LIBS opencv-data libopencv-calib3d2.4 libopencv-contrib2.4 libopencv-core2.4
|
set(STD_OPENCV_LIBS opencv-data)
|
||||||
libopencv-features2d2.4 libopencv-flann2.4 libopencv-gpu2.4 libopencv-imgproc2.4
|
set(STD_OPENCV_DEV libopencv-dev)
|
||||||
libopencv-ml2.4 libopencv-ocl2.4 libopencv-stitching2.4 libopencv-ts2.4 libopencv-videostab2.4)
|
|
||||||
|
|
||||||
set(STD_OPENCV_DEV libopencv-calib3d-dev libopencv-contrib-dev libopencv-core-dev
|
foreach(module calib3d contrib core features2d flann gpu highgui imgproc legacy
|
||||||
libopencv-dev libopencv-features2d-dev libopencv-flann-dev libopencv-gpu-dev
|
ml objdetect ocl photo stitching superres ts video videostab)
|
||||||
libopencv-highgui-dev libopencv-imgproc-dev libopencv-legacy-dev libopencv-ml-dev
|
if(HAVE_opencv_${module})
|
||||||
libopencv-objdetect-dev libopencv-ocl-dev libopencv-photo-dev libopencv-stitching-dev
|
list(APPEND STD_OPENCV_LIBS "libopencv-${module}2.4")
|
||||||
libopencv-superres-dev libopencv-ts-dev libopencv-video-dev libopencv-videostab-dev)
|
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_CONFLICTS "${STD_OPENCV_LIBS}")
|
||||||
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_PROVIDES "${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 "${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(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}")
|
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}"
|
execute_process(COMMAND "${GZIP_TOOL}" "-cf9" "${DEBIAN_CHANGELOG_OUT_FILE}"
|
||||||
OUTPUT_FILE "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
OUTPUT_FILE "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
||||||
@@ -200,6 +204,25 @@ if(CPACK_GENERATOR STREQUAL "DEB")
|
|||||||
install(FILES "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
install(FILES "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
|
||||||
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
|
||||||
COMPONENT "${comp}")
|
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()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -630,3 +630,21 @@ function(ocv_source_group group)
|
|||||||
file(GLOB srcs ${OCV_SOURCE_GROUP_GLOB})
|
file(GLOB srcs ${OCV_SOURCE_GROUP_GLOB})
|
||||||
source_group(${group} FILES ${srcs})
|
source_group(${group} FILES ${srcs})
|
||||||
endfunction()
|
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
|
@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.
|
documentation for more details.
|
||||||
-- @CPACK_PACKAGE_CONTACT@ @CHANGELOG_PACKAGE_DATE@
|
-- @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__
|
#ifndef __OPENCV_OLD_CXMISC_H__
|
||||||
#define __OPENCV_OLD_CXMISC_H__
|
#define __OPENCV_OLD_CXMISC_H__
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ struct CvCBQuad
|
|||||||
//static CvMat* debug_img = 0;
|
//static CvMat* debug_img = 0;
|
||||||
|
|
||||||
static int icvGenerateQuads( CvCBQuad **quads, CvCBCorner **corners,
|
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
|
/*static int
|
||||||
icvGenerateQuadsEx( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
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,
|
static int icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||||
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
|
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);
|
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
|
#endif
|
||||||
|
|
||||||
static int icvAddOuterQuad(CvCBQuad *quad, CvCBQuad **quads, int quad_count,
|
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);
|
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.
|
// making it difficult to detect smaller squares.
|
||||||
for( k = 0; k < 6; k++ )
|
for( k = 0; k < 6; k++ )
|
||||||
{
|
{
|
||||||
|
int max_quad_buf_size = 0;
|
||||||
for( dilations = min_dilations; dilations <= max_dilations; dilations++ )
|
for( dilations = min_dilations; dilations <= max_dilations; dilations++ )
|
||||||
{
|
{
|
||||||
if (found)
|
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,
|
cvRectangle( thresh_img, cvPoint(0,0), cvPoint(thresh_img->cols-1,
|
||||||
thresh_img->rows-1), CV_RGB(255,255,255), 3, 8);
|
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);
|
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
|
// allocate extra for adding in icvOrderFoundQuads
|
||||||
cvFree(&quad_group);
|
cvFree(&quad_group);
|
||||||
cvFree(&corner_group);
|
cvFree(&corner_group);
|
||||||
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * (quad_count+quad_count / 2));
|
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * max_quad_buf_size);
|
||||||
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * (quad_count+quad_count / 2)*4 );
|
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * max_quad_buf_size * 4 );
|
||||||
|
|
||||||
for( group_idx = 0; ; group_idx++ )
|
for( group_idx = 0; ; group_idx++ )
|
||||||
{
|
{
|
||||||
@@ -424,7 +425,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
|
|||||||
// maybe delete or add some
|
// maybe delete or add some
|
||||||
PRINTF("Starting ordering of inner quads\n");
|
PRINTF("Starting ordering of inner quads\n");
|
||||||
count = icvOrderFoundConnectedQuads(count, quad_group, &quad_count, &quads, &corners,
|
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);
|
PRINTF("Orig count: %d After ordering: %d\n", icount, count);
|
||||||
|
|
||||||
|
|
||||||
@@ -623,7 +624,7 @@ icvCheckBoardMonotony( CvPoint2D32f* corners, CvSize pattern_size )
|
|||||||
static int
|
static int
|
||||||
icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
||||||
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
|
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 );
|
cv::Ptr<CvMemStorage> temp_storage = cvCreateChildMemStorage( storage );
|
||||||
CvSeq* stack = cvCreateSeq( 0, sizeof(*stack), sizeof(void*), temp_storage );
|
CvSeq* stack = cvCreateSeq( 0, sizeof(*stack), sizeof(void*), temp_storage );
|
||||||
@@ -803,15 +804,18 @@ icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
|
|||||||
if (found > 0)
|
if (found > 0)
|
||||||
{
|
{
|
||||||
PRINTF("Found %d inner quads not connected to outer quads, repairing\n", found);
|
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)
|
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;
|
*all_count += added;
|
||||||
quad_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
|
static int
|
||||||
icvAddOuterQuad( CvCBQuad *quad, CvCBQuad **quads, int quad_count,
|
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;
|
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
|
if (!quad->neighbors[i]) // ok, create and add neighbor
|
||||||
{
|
{
|
||||||
@@ -1649,7 +1653,7 @@ static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count )
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
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;
|
int quad_count = 0;
|
||||||
cv::Ptr<CvMemStorage> temp_storage;
|
cv::Ptr<CvMemStorage> temp_storage;
|
||||||
@@ -1754,8 +1758,9 @@ icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
|
|||||||
cvEndFindContours( &scanner );
|
cvEndFindContours( &scanner );
|
||||||
|
|
||||||
// allocate quad & corner buffers
|
// allocate quad & corner buffers
|
||||||
*out_quads = (CvCBQuad*)cvAlloc((root->total+root->total / 2) * sizeof((*out_quads)[0]));
|
*max_quad_buf_size = MAX(1, (root->total+root->total / 2)) * 2;
|
||||||
*out_corners = (CvCBCorner*)cvAlloc((root->total+root->total / 2) * 4 * sizeof((*out_corners)[0]));
|
*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
|
// Create array of quads structures
|
||||||
for( idx = 0; idx < root->total; idx++ )
|
for( idx = 0; idx < root->total; idx++ )
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
//
|
//
|
||||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
// Copyright (C) 2009, Willow Garage Inc., 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.
|
// Third party copyrights are property of their respective owners.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
@@ -562,6 +563,9 @@ void CV_HomographyTest::run(int)
|
|||||||
default: continue;
|
default: continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[]src_data;
|
||||||
|
src_data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
/*! \file core.hpp
|
|
||||||
\brief The Core Functionality
|
|
||||||
*/
|
|
||||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
/*! \file core.hpp
|
|
||||||
\brief The Core Functionality
|
|
||||||
*/
|
|
||||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#define CV_VERSION_EPOCH 2
|
#define CV_VERSION_EPOCH 2
|
||||||
#define CV_VERSION_MAJOR 4
|
#define CV_VERSION_MAJOR 4
|
||||||
#define CV_VERSION_MINOR 12
|
#define CV_VERSION_MINOR 12
|
||||||
#define CV_VERSION_REVISION 0
|
#define CV_VERSION_REVISION 2
|
||||||
|
|
||||||
#define CVAUX_STR_EXP(__A) #__A
|
#define CVAUX_STR_EXP(__A) #__A
|
||||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||||
|
|||||||
@@ -346,6 +346,7 @@ CV_IMPL CvString
|
|||||||
cvMemStorageAllocString( CvMemStorage* storage, const char* ptr, int len )
|
cvMemStorageAllocString( CvMemStorage* storage, const char* ptr, int len )
|
||||||
{
|
{
|
||||||
CvString str;
|
CvString str;
|
||||||
|
memset(&str, 0, sizeof(CvString));
|
||||||
|
|
||||||
str.len = len >= 0 ? len : (int)strlen(ptr);
|
str.len = len >= 0 ? len : (int)strlen(ptr);
|
||||||
str.ptr = (char*)cvMemStorageAlloc( storage, str.len + 1 );
|
str.ptr = (char*)cvMemStorageAlloc( storage, str.len + 1 );
|
||||||
@@ -1688,6 +1689,9 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice )
|
|||||||
|
|
||||||
slice.end_index = slice.start_index + length;
|
slice.end_index = slice.start_index + length;
|
||||||
|
|
||||||
|
if ( slice.start_index == slice.end_index )
|
||||||
|
return;
|
||||||
|
|
||||||
if( slice.end_index < total )
|
if( slice.end_index < total )
|
||||||
{
|
{
|
||||||
CvSeqReader reader_to, reader_from;
|
CvSeqReader reader_to, reader_from;
|
||||||
|
|||||||
@@ -2216,6 +2216,7 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
|
|||||||
Mat p = pts.getMat(manyContours ? i : -1);
|
Mat p = pts.getMat(manyContours ? i : -1);
|
||||||
if( p.total() == 0 )
|
if( p.total() == 0 )
|
||||||
{
|
{
|
||||||
|
ptsptr[i] = NULL;
|
||||||
npts[i] = 0;
|
npts[i] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ class Core_SeqBaseTest : public Core_DynStructBaseTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Core_SeqBaseTest();
|
Core_SeqBaseTest();
|
||||||
|
virtual ~Core_SeqBaseTest();
|
||||||
void clear();
|
void clear();
|
||||||
void run( int );
|
void run( int );
|
||||||
|
|
||||||
@@ -503,11 +504,14 @@ protected:
|
|||||||
int test_seq_ops( int iters );
|
int test_seq_ops( int iters );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Core_SeqBaseTest::Core_SeqBaseTest()
|
Core_SeqBaseTest::Core_SeqBaseTest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core_SeqBaseTest::~Core_SeqBaseTest()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
void Core_SeqBaseTest::clear()
|
void Core_SeqBaseTest::clear()
|
||||||
{
|
{
|
||||||
@@ -1208,6 +1212,7 @@ class Core_SetTest : public Core_DynStructBaseTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Core_SetTest();
|
Core_SetTest();
|
||||||
|
virtual ~Core_SetTest();
|
||||||
void clear();
|
void clear();
|
||||||
void run( int );
|
void run( int );
|
||||||
|
|
||||||
@@ -1221,6 +1226,10 @@ Core_SetTest::Core_SetTest()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core_SetTest::~Core_SetTest()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
void Core_SetTest::clear()
|
void Core_SetTest::clear()
|
||||||
{
|
{
|
||||||
@@ -1419,6 +1428,7 @@ class Core_GraphTest : public Core_DynStructBaseTest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Core_GraphTest();
|
Core_GraphTest();
|
||||||
|
virtual ~Core_GraphTest();
|
||||||
void clear();
|
void clear();
|
||||||
void run( int );
|
void run( int );
|
||||||
|
|
||||||
@@ -1432,6 +1442,10 @@ Core_GraphTest::Core_GraphTest()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core_GraphTest::~Core_GraphTest()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
void 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,
|
CV_TS_SEQ_CHECK_CONDITION( vtx_count == 0 && edge_count == 0,
|
||||||
"Not every vertex/edge has been visited" );
|
"Not every vertex/edge has been visited" );
|
||||||
update_progressbar();
|
update_progressbar();
|
||||||
|
|
||||||
|
cvReleaseGraphScanner( &scanner );
|
||||||
}
|
}
|
||||||
|
|
||||||
// for a random graph the test just checks that every graph vertex and
|
// for a random graph the test just checks that every graph vertex and
|
||||||
@@ -2108,8 +2124,6 @@ void Core_GraphScanTest::run( int )
|
|||||||
catch(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.rows, sizeof(int), 1, f );
|
||||||
fwrite( (void*)&mat.cols, sizeof(int), 1, f );
|
fwrite( (void*)&mat.cols, sizeof(int), 1, f );
|
||||||
fwrite( (void*)&type, 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*)&dataSize, sizeof(int), 1, f );
|
||||||
fwrite( (void*)mat.data, 1, dataSize, f );
|
fwrite( (void*)mat.data, 1, dataSize, f );
|
||||||
fclose(f);
|
fclose(f);
|
||||||
@@ -80,12 +80,15 @@ static Mat readMatFromBin( const string& filename )
|
|||||||
size_t elements_read4 = fread( (void*)&dataSize, sizeof(int), 1, f );
|
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);
|
CV_Assert(elements_read1 == 1 && elements_read2 == 1 && elements_read3 == 1 && elements_read4 == 1);
|
||||||
|
|
||||||
uchar* data = (uchar*)cvAlloc(dataSize);
|
Mat returnMat(rows, cols, type);
|
||||||
size_t elements_read = fread( (void*)data, 1, dataSize, f );
|
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));
|
CV_Assert(elements_read == (size_t)(dataSize));
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
return Mat( rows, cols, type, data );
|
return returnMat;
|
||||||
}
|
}
|
||||||
return Mat();
|
return Mat();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,7 +303,8 @@ public:
|
|||||||
//
|
//
|
||||||
// constructor
|
// 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),
|
tp(_tp),
|
||||||
target_accuracy_margin_from_bfmatcher(_accuracy_margin),
|
target_accuracy_margin_from_bfmatcher(_accuracy_margin),
|
||||||
fe(_fe),
|
fe(_fe),
|
||||||
@@ -318,6 +319,15 @@ public:
|
|||||||
bfmatcher = new cv::BFMatcher(norm_type_for_bfmatcher);
|
bfmatcher = new cv::BFMatcher(norm_type_for_bfmatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ~CV_FeatureDetectorMatcherBaseTest()
|
||||||
|
{
|
||||||
|
if (bfmatcher)
|
||||||
|
{
|
||||||
|
delete bfmatcher;
|
||||||
|
bfmatcher = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Main Test method
|
// Main Test method
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -65,13 +65,13 @@ protected:
|
|||||||
virtual void run( int start_from );
|
virtual void run( int start_from );
|
||||||
virtual void createModel( const Mat& data ) = 0;
|
virtual void createModel( const Mat& data ) = 0;
|
||||||
virtual int findNeighbors( Mat& points, Mat& neighbors ) = 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 checkFindBoxed();
|
||||||
virtual int checkFind( const Mat& data );
|
virtual int checkFind( const Mat& data );
|
||||||
virtual void releaseModel() = 0;
|
virtual void releaseModel() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
int NearestNeighborTest::checkGetPoins( const Mat& )
|
int NearestNeighborTest::checkGetPoints( const Mat& )
|
||||||
{
|
{
|
||||||
return cvtest::TS::OK;
|
return cvtest::TS::OK;
|
||||||
}
|
}
|
||||||
@@ -125,11 +125,11 @@ int NearestNeighborTest::checkFind( const Mat& data )
|
|||||||
void NearestNeighborTest::run( int /*start_from*/ ) {
|
void NearestNeighborTest::run( int /*start_from*/ ) {
|
||||||
int code = cvtest::TS::OK, tempCode;
|
int code = cvtest::TS::OK, tempCode;
|
||||||
Mat desc( featuresCount, dims, CV_32FC1 );
|
Mat desc( featuresCount, dims, CV_32FC1 );
|
||||||
randu( desc, Scalar(minValue), Scalar(maxValue) );
|
ts->get_rng().fill( desc, RNG::UNIFORM, minValue, maxValue );
|
||||||
|
|
||||||
createModel( desc );
|
createModel( desc );
|
||||||
|
|
||||||
tempCode = checkGetPoins( desc );
|
tempCode = checkGetPoints( desc );
|
||||||
if( tempCode != cvtest::TS::OK )
|
if( tempCode != cvtest::TS::OK )
|
||||||
{
|
{
|
||||||
ts->printf( cvtest::TS::LOG, "bad accuracy of GetPoints \n" );
|
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
|
class CV_KDTreeTest_CPP : public NearestNeighborTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CV_KDTreeTest_CPP() {}
|
CV_KDTreeTest_CPP() : NearestNeighborTest(), tr(NULL) {}
|
||||||
protected:
|
protected:
|
||||||
virtual void createModel( const Mat& data );
|
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 findNeighbors( Mat& points, Mat& neighbors );
|
||||||
virtual int checkFindBoxed();
|
virtual int checkFindBoxed();
|
||||||
virtual void releaseModel();
|
virtual void releaseModel();
|
||||||
@@ -175,7 +175,7 @@ void CV_KDTreeTest_CPP::createModel( const Mat& data )
|
|||||||
tr = new KDTree( data, false );
|
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() ),
|
Mat res1( data.size(), data.type() ),
|
||||||
res3( data.size(), data.type() );
|
res3( data.size(), data.type() );
|
||||||
@@ -244,7 +244,7 @@ void CV_KDTreeTest_CPP::releaseModel()
|
|||||||
class CV_FlannTest : public NearestNeighborTest
|
class CV_FlannTest : public NearestNeighborTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CV_FlannTest() {}
|
CV_FlannTest() : NearestNeighborTest(), index(NULL) { }
|
||||||
protected:
|
protected:
|
||||||
void createIndex( const Mat& data, const IndexParams& params );
|
void createIndex( const Mat& data, const IndexParams& params );
|
||||||
int knnSearch( Mat& points, Mat& neighbors );
|
int knnSearch( Mat& points, Mat& neighbors );
|
||||||
@@ -255,6 +255,9 @@ protected:
|
|||||||
|
|
||||||
void CV_FlannTest::createIndex( const Mat& data, const IndexParams& params )
|
void CV_FlannTest::createIndex( const Mat& data, const IndexParams& params )
|
||||||
{
|
{
|
||||||
|
// release previously allocated index
|
||||||
|
releaseModel();
|
||||||
|
|
||||||
index = new Index( data, params );
|
index = new Index( data, params );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +324,11 @@ int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
|
|||||||
|
|
||||||
void CV_FlannTest::releaseModel()
|
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_
|
#ifndef OPENCV_FLANN_DUMMY_H_
|
||||||
#define OPENCV_FLANN_DUMMY_H_
|
#define OPENCV_FLANN_DUMMY_H_
|
||||||
|
|||||||
@@ -384,6 +384,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
root_ = pool_.allocate<KMeansNode>();
|
root_ = pool_.allocate<KMeansNode>();
|
||||||
|
std::memset(root_, 0, sizeof(KMeansNode));
|
||||||
|
|
||||||
computeNodeStatistics(root_, indices_, (int)size_);
|
computeNodeStatistics(root_, indices_, (int)size_);
|
||||||
computeClustering(root_, indices_, (int)size_, branching_,0);
|
computeClustering(root_, indices_, (int)size_, branching_,0);
|
||||||
}
|
}
|
||||||
@@ -823,11 +825,11 @@ private:
|
|||||||
variance -= distance_(centers[c], ZeroIterator<ElementType>(), veclen_);
|
variance -= distance_(centers[c], ZeroIterator<ElementType>(), veclen_);
|
||||||
|
|
||||||
node->childs[c] = pool_.allocate<KMeansNode>();
|
node->childs[c] = pool_.allocate<KMeansNode>();
|
||||||
|
std::memset(node->childs[c], 0, sizeof(KMeansNode));
|
||||||
node->childs[c]->radius = radiuses[c];
|
node->childs[c]->radius = radiuses[c];
|
||||||
node->childs[c]->pivot = centers[c];
|
node->childs[c]->pivot = centers[c];
|
||||||
node->childs[c]->variance = variance;
|
node->childs[c]->variance = variance;
|
||||||
node->childs[c]->mean_radius = mean_radius;
|
node->childs[c]->mean_radius = mean_radius;
|
||||||
node->childs[c]->indices = NULL;
|
|
||||||
computeClustering(node->childs[c],indices+start, end-start, branching, level+1);
|
computeClustering(node->childs[c],indices+start, end-start, branching, level+1);
|
||||||
start=end;
|
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);
|
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
|
||||||
|
|
||||||
IndexType* _index = NULL;
|
// currently, additional index support is the lsh algorithm only.
|
||||||
if( !index || getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR) != FLANN_INDEX_LSH) // 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->buildIndex();
|
||||||
index = _index;
|
index = _index;
|
||||||
|
// HACK to prevent object destruction
|
||||||
|
_index.obj = NULL;
|
||||||
}
|
}
|
||||||
else // build additional lsh index
|
else // build additional lsh index
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ namespace cv { namespace gpu { namespace device
|
|||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template <typename T>
|
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 x = blockIdx.x * blockDim.x + threadIdx.x;
|
||||||
const int y = blockIdx.y * blockDim.y + threadIdx.y;
|
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)
|
for (int d = 0; d < cndisp; ++d)
|
||||||
{
|
{
|
||||||
float dst_reg = src.ptr(d * src_rows + (2*y+0))[(2*x+0)];
|
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 + (2*y+1))[(2*x+0)];
|
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 + (2*y+0))[(2*x+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 + (2*y+1))[(2*x+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);
|
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>
|
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 threads(32, 8, 1);
|
||||||
dim3 grid(1, 1, 1);
|
dim3 grid(1, 1, 1);
|
||||||
@@ -283,15 +283,15 @@ namespace cv { namespace gpu { namespace device
|
|||||||
grid.x = divUp(dst_cols, threads.x);
|
grid.x = divUp(dst_cols, threads.x);
|
||||||
grid.y = divUp(dst_rows, threads.y);
|
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() );
|
cudaSafeCall( cudaGetLastError() );
|
||||||
|
|
||||||
if (stream == 0)
|
if (stream == 0)
|
||||||
cudaSafeCall( cudaDeviceSynchronize() );
|
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<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_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 ////////////////////////
|
/////////////////// level up messages ////////////////////////
|
||||||
|
|||||||
@@ -2804,7 +2804,7 @@ void cv::gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, St
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int elem_size = src.elemSize1();
|
const int elem_size = static_cast<int>(src.elemSize1());
|
||||||
const int num_channels = src.channels();
|
const int num_channels = src.channels();
|
||||||
const int bcols = src.cols * num_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
|
else
|
||||||
{
|
{
|
||||||
const int elem_size = src1.elemSize1();
|
const int elem_size = static_cast<int>(src1.elemSize1());
|
||||||
const int num_channels = src1.channels();
|
const int num_channels = src1.channels();
|
||||||
const int bcols = src1.cols * num_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
|
else
|
||||||
{
|
{
|
||||||
const int elem_size = src1.elemSize1();
|
const int elem_size = static_cast<int>(src1.elemSize1());
|
||||||
const int num_channels = src1.channels();
|
const int num_channels = src1.channels();
|
||||||
const int bcols = src1.cols * num_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
|
else
|
||||||
{
|
{
|
||||||
const int elem_size = src1.elemSize1();
|
const int elem_size = static_cast<int>(src1.elemSize1());
|
||||||
const int num_channels = src1.channels();
|
const int num_channels = src1.channels();
|
||||||
const int bcols = src1.cols * num_channels;
|
const int bcols = src1.cols * num_channels;
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace cv { namespace gpu { namespace device
|
|||||||
template<typename T, typename D>
|
template<typename T, typename D>
|
||||||
void comp_data_gpu(const PtrStepSzb& left, const PtrStepSzb& right, const PtrStepSzb& data, cudaStream_t stream);
|
void comp_data_gpu(const PtrStepSzb& left, const PtrStepSzb& right, const PtrStepSzb& data, cudaStream_t stream);
|
||||||
template<typename T>
|
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>
|
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);
|
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>
|
template <typename T>
|
||||||
@@ -158,7 +158,7 @@ namespace
|
|||||||
|
|
||||||
init(stream);
|
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));
|
comp_data_callers[rthis.msg_type == CV_32F][left.channels()](left, right, datas[0], StreamAccessor::getStream(stream));
|
||||||
|
|
||||||
@@ -187,10 +187,10 @@ namespace
|
|||||||
private:
|
private:
|
||||||
void init(Stream& stream)
|
void init(Stream& stream)
|
||||||
{
|
{
|
||||||
u.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, u);
|
||||||
d.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, d);
|
||||||
l.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, l);
|
||||||
r.create(rows * rthis.ndisp, cols, rthis.msg_type);
|
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, r);
|
||||||
|
|
||||||
if (rthis.levels & 1)
|
if (rthis.levels & 1)
|
||||||
{
|
{
|
||||||
@@ -216,10 +216,10 @@ namespace
|
|||||||
int less_rows = (rows + 1) / 2;
|
int less_rows = (rows + 1) / 2;
|
||||||
int less_cols = (cols + 1) / 2;
|
int less_cols = (cols + 1) / 2;
|
||||||
|
|
||||||
u2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, u2);
|
||||||
d2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, d2);
|
||||||
l2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, l2);
|
||||||
r2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
|
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, r2);
|
||||||
|
|
||||||
if ((rthis.levels & 1) == 0)
|
if ((rthis.levels & 1) == 0)
|
||||||
{
|
{
|
||||||
@@ -253,7 +253,7 @@ namespace
|
|||||||
|
|
||||||
void calcBP(GpuMat& disp, Stream& stream)
|
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] =
|
static const data_step_down_t data_step_down_callers[2] =
|
||||||
{
|
{
|
||||||
data_step_down_gpu<short>, data_step_down_gpu<float>
|
data_step_down_gpu<short>, data_step_down_gpu<float>
|
||||||
@@ -286,9 +286,9 @@ namespace
|
|||||||
cols_all[i] = (cols_all[i-1] + 1) / 2;
|
cols_all[i] = (cols_all[i-1] + 1) / 2;
|
||||||
rows_all[i] = (rows_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};
|
PtrStepSzb mus[] = {u, u2};
|
||||||
|
|||||||
@@ -114,7 +114,9 @@ GPU_TEST_P(StereoBeliefPropagation, Regression)
|
|||||||
cv::Mat h_disp(disp);
|
cv::Mat h_disp(disp);
|
||||||
h_disp.convertTo(h_disp, disp_gold.depth());
|
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);
|
INSTANTIATE_TEST_CASE_P(GPU_Calib3D, StereoBeliefPropagation, ALL_DEVICES);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ set(highgui_srcs
|
|||||||
src/window.cpp
|
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)
|
if(HAVE_QT5)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|||||||
@@ -238,10 +238,12 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, 0);
|
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2,
|
||||||
|
reinterpret_cast<char *>(index));
|
||||||
if (capture)
|
if (capture)
|
||||||
return capture;
|
return capture;
|
||||||
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L, 0);
|
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L,
|
||||||
|
reinterpret_cast<char *>(index));
|
||||||
if (capture)
|
if (capture)
|
||||||
return capture;
|
return capture;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -75,10 +75,13 @@
|
|||||||
|
|
||||||
#if GST_VERSION_MAJOR == 0
|
#if GST_VERSION_MAJOR == 0
|
||||||
#define COLOR_ELEM "ffmpegcolorspace"
|
#define COLOR_ELEM "ffmpegcolorspace"
|
||||||
|
#define COLOR_ELEM_NAME "ffmpegcsp"
|
||||||
#elif FULL_GST_VERSION < VERSION_NUM(1,5,0)
|
#elif FULL_GST_VERSION < VERSION_NUM(1,5,0)
|
||||||
#define COLOR_ELEM "videoconvert"
|
#define COLOR_ELEM "videoconvert"
|
||||||
|
#define COLOR_ELEM_NAME COLOR_ELEM
|
||||||
#else
|
#else
|
||||||
#define COLOR_ELEM "autovideoconvert"
|
#define COLOR_ELEM "autovideoconvert"
|
||||||
|
#define COLOR_ELEM_NAME COLOR_ELEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void toFraction(double decimal, double &numerator, double &denominator);
|
void toFraction(double decimal, double &numerator, double &denominator);
|
||||||
@@ -142,6 +145,7 @@ protected:
|
|||||||
gpointer data);
|
gpointer data);
|
||||||
GstElement* pipeline;
|
GstElement* pipeline;
|
||||||
GstElement* uridecodebin;
|
GstElement* uridecodebin;
|
||||||
|
GstElement* v4l2src;
|
||||||
GstElement* color;
|
GstElement* color;
|
||||||
GstElement* sink;
|
GstElement* sink;
|
||||||
#if GST_VERSION_MAJOR > 0
|
#if GST_VERSION_MAJOR > 0
|
||||||
@@ -165,6 +169,7 @@ void CvCapture_GStreamer::init()
|
|||||||
{
|
{
|
||||||
pipeline = NULL;
|
pipeline = NULL;
|
||||||
uridecodebin = NULL;
|
uridecodebin = NULL;
|
||||||
|
v4l2src = NULL;
|
||||||
color = NULL;
|
color = NULL;
|
||||||
sink = NULL;
|
sink = NULL;
|
||||||
#if GST_VERSION_MAJOR > 0
|
#if GST_VERSION_MAJOR > 0
|
||||||
@@ -371,9 +376,7 @@ void CvCapture_GStreamer::startPipeline()
|
|||||||
if (status == GST_STATE_CHANGE_ASYNC)
|
if (status == GST_STATE_CHANGE_ASYNC)
|
||||||
{
|
{
|
||||||
// wait for status update
|
// wait for status update
|
||||||
GstState st1;
|
status = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
||||||
GstState st2;
|
|
||||||
status = gst_element_get_state(pipeline, &st1, &st2, GST_CLOCK_TIME_NONE);
|
|
||||||
}
|
}
|
||||||
if (status == GST_STATE_CHANGE_FAILURE)
|
if (status == GST_STATE_CHANGE_FAILURE)
|
||||||
{
|
{
|
||||||
@@ -568,21 +571,39 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
|||||||
GstElementFactory * testfac;
|
GstElementFactory * testfac;
|
||||||
GstStateChangeReturn status;
|
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");
|
testfac = gst_element_factory_find("v4lsrc");
|
||||||
if (!testfac){
|
if (!testfac){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
g_object_unref(G_OBJECT(testfac));
|
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");
|
testfac = gst_element_factory_find("v4l2src");
|
||||||
if (!testfac){
|
if (!testfac){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
g_object_unref(G_OBJECT(testfac));
|
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;
|
stream = true;
|
||||||
manualpipeline = true;
|
manualpipeline = true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
stream = true;
|
stream = true;
|
||||||
uri = g_strdup(filename);
|
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);
|
uridecodebin = gst_element_make_from_uri(GST_URI_SRC, uri, "src", NULL);
|
||||||
#endif
|
#endif
|
||||||
element_from_uri = true;
|
element_from_uri = true;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
uridecodebin = gst_element_factory_make("uridecodebin", NULL);
|
uridecodebin = gst_element_factory_make("uridecodebin", NULL);
|
||||||
g_object_set(G_OBJECT(uridecodebin), "uri", uri, NULL);
|
g_object_set(G_OBJECT(uridecodebin), "uri", uri, NULL);
|
||||||
}
|
}
|
||||||
g_free(protocol);
|
g_free(protocol);
|
||||||
|
|
||||||
if(!uridecodebin) {
|
if(!uridecodebin)
|
||||||
|
{
|
||||||
//fprintf(stderr, "GStreamer: Error opening bin: %s\n", err->message);
|
//fprintf(stderr, "GStreamer: Error opening bin: %s\n", err->message);
|
||||||
close();
|
close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(manualpipeline)
|
if (manualpipeline)
|
||||||
{
|
{
|
||||||
GstIterator *it = NULL;
|
GstIterator *it = gst_bin_iterate_elements(GST_BIN(uridecodebin));
|
||||||
#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));
|
|
||||||
|
|
||||||
gboolean done = FALSE;
|
|
||||||
GstElement *element = NULL;
|
GstElement *element = NULL;
|
||||||
|
gboolean done = false;
|
||||||
gchar* name = NULL;
|
gchar* name = NULL;
|
||||||
|
#if GST_VERSION_MAJOR > 0
|
||||||
GValue value = G_VALUE_INIT;
|
GValue value = G_VALUE_INIT;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (!done) {
|
while (!done)
|
||||||
switch (gst_iterator_next (it, &value)) {
|
{
|
||||||
|
#if GST_VERSION_MAJOR > 0
|
||||||
|
switch (gst_iterator_next (it, &value))
|
||||||
|
{
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
element = GST_ELEMENT (g_value_get_object (&value));
|
element = GST_ELEMENT (g_value_get_object (&value));
|
||||||
name = gst_element_get_name(element);
|
#else
|
||||||
if (name){
|
switch (gst_iterator_next (it, (gpointer *)&element))
|
||||||
if(strstr(name, "opencvsink") != NULL || strstr(name, "appsink") != NULL) {
|
{
|
||||||
sink = GST_ELEMENT ( gst_object_ref (element) );
|
case GST_ITERATOR_OK:
|
||||||
done = TRUE;
|
#endif
|
||||||
}
|
name = gst_element_get_name(element);
|
||||||
g_free(name);
|
if (name)
|
||||||
}
|
{
|
||||||
g_value_unset (&value);
|
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:
|
case GST_ITERATOR_RESYNC:
|
||||||
gst_iterator_resync (it);
|
gst_iterator_resync (it);
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_ERROR:
|
case GST_ITERATOR_ERROR:
|
||||||
case GST_ITERATOR_DONE:
|
case GST_ITERATOR_DONE:
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
|
if (!sink)
|
||||||
if (!sink){
|
{
|
||||||
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
|
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
pipeline = uridecodebin;
|
pipeline = uridecodebin;
|
||||||
}
|
}
|
||||||
else
|
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);
|
gst_bin_add_many(GST_BIN(pipeline), uridecodebin, color, sink, NULL);
|
||||||
|
|
||||||
if(element_from_uri) {
|
if(element_from_uri)
|
||||||
if(!gst_element_link(uridecodebin, color)) {
|
{
|
||||||
|
if(!gst_element_link(uridecodebin, color))
|
||||||
|
{
|
||||||
CV_ERROR(CV_StsError, "GStreamer: cannot link color -> sink\n");
|
CV_ERROR(CV_StsError, "GStreamer: cannot link color -> sink\n");
|
||||||
gst_object_unref(pipeline);
|
gst_object_unref(pipeline);
|
||||||
pipeline = NULL;
|
pipeline = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
g_signal_connect(uridecodebin, "pad-added", G_CALLBACK(newPad), color);
|
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");
|
CV_ERROR(CV_StsError, "GStreamer: cannot link color -> sink\n");
|
||||||
gst_object_unref(pipeline);
|
gst_object_unref(pipeline);
|
||||||
pipeline = NULL;
|
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_app_sink_set_caps(GST_APP_SINK(sink), caps);
|
||||||
gst_caps_unref(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)
|
if (status == GST_STATE_CHANGE_ASYNC)
|
||||||
{
|
{
|
||||||
// wait for status update
|
// wait for status update
|
||||||
GstState st1;
|
status = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
||||||
GstState st2;
|
|
||||||
status = gst_element_get_state(pipeline, &st1, &st2, GST_CLOCK_TIME_NONE);
|
|
||||||
}
|
}
|
||||||
if (status == GST_STATE_CHANGE_FAILURE)
|
if (status == GST_STATE_CHANGE_FAILURE)
|
||||||
{
|
{
|
||||||
@@ -814,14 +857,9 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
|||||||
|
|
||||||
fps = (double)num/(double)denom;
|
fps = (double)num/(double)denom;
|
||||||
|
|
||||||
// GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");
|
// GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline")
|
||||||
}
|
|
||||||
else
|
stopPipeline();
|
||||||
{
|
|
||||||
duration = -1;
|
|
||||||
width = -1;
|
|
||||||
height = -1;
|
|
||||||
fps = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__END__;
|
__END__;
|
||||||
@@ -852,7 +890,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
|||||||
|
|
||||||
if(!pipeline) {
|
if(!pipeline) {
|
||||||
CV_WARN("GStreamer: no pipeline");
|
CV_WARN("GStreamer: no pipeline");
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(propId) {
|
switch(propId) {
|
||||||
@@ -861,7 +899,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
|||||||
status = gst_element_query_position(sink, FORMAT, &value);
|
status = gst_element_query_position(sink, FORMAT, &value);
|
||||||
if(!status) {
|
if(!status) {
|
||||||
CV_WARN("GStreamer: unable to query position of stream");
|
CV_WARN("GStreamer: unable to query position of stream");
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
return value * 1e-6; // nano seconds to milli seconds
|
return value * 1e-6; // nano seconds to milli seconds
|
||||||
case CV_CAP_PROP_POS_FRAMES:
|
case CV_CAP_PROP_POS_FRAMES:
|
||||||
@@ -869,7 +907,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
|||||||
status = gst_element_query_position(sink, FORMAT, &value);
|
status = gst_element_query_position(sink, FORMAT, &value);
|
||||||
if(!status) {
|
if(!status) {
|
||||||
CV_WARN("GStreamer: unable to query position of stream");
|
CV_WARN("GStreamer: unable to query position of stream");
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
case CV_CAP_PROP_POS_AVI_RATIO:
|
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);
|
status = gst_element_query_position(sink, FORMAT, &value);
|
||||||
if(!status) {
|
if(!status) {
|
||||||
CV_WARN("GStreamer: unable to query position of stream");
|
CV_WARN("GStreamer: unable to query position of stream");
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
return ((double) value) / GST_FORMAT_PERCENT_MAX;
|
return ((double) value) / GST_FORMAT_PERCENT_MAX;
|
||||||
case CV_CAP_PROP_FRAME_WIDTH:
|
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_CONTRAST:
|
||||||
case CV_CAP_PROP_SATURATION:
|
case CV_CAP_PROP_SATURATION:
|
||||||
case CV_CAP_PROP_HUE:
|
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_GAIN:
|
||||||
case CV_CAP_PROP_CONVERT_RGB:
|
case CV_CAP_PROP_CONVERT_RGB:
|
||||||
break;
|
break;
|
||||||
@@ -912,7 +965,7 @@ double CvCapture_GStreamer::getProperty( int propId )
|
|||||||
|
|
||||||
#undef FORMAT
|
#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_CONTRAST:
|
||||||
case CV_CAP_PROP_SATURATION:
|
case CV_CAP_PROP_SATURATION:
|
||||||
case CV_CAP_PROP_HUE:
|
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_GAIN:
|
||||||
case CV_CAP_PROP_CONVERT_RGB:
|
case CV_CAP_PROP_CONVERT_RGB:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -221,7 +221,12 @@ bool TiffDecoder::readData( Mat& img )
|
|||||||
(!is_tiled && tile_height0 == std::numeric_limits<uint32>::max()) )
|
(!is_tiled && tile_height0 == std::numeric_limits<uint32>::max()) )
|
||||||
tile_height0 = m_height;
|
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 );
|
AutoBuffer<uchar> _buffer( buffer_size );
|
||||||
uchar* buffer = _buffer;
|
uchar* buffer = _buffer;
|
||||||
ushort* buffer16 = (ushort*)buffer;
|
ushort* buffer16 = (ushort*)buffer;
|
||||||
|
|||||||
@@ -396,6 +396,10 @@ TEST(Highgui_Video_parallel_writers_and_readers, accuracy)
|
|||||||
if (code == 1)
|
if (code == 1)
|
||||||
std::cerr << "Couldn't delete " << *i << std::endl;
|
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
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
/*! \file imgproc.hpp
|
|
||||||
\brief The Image Processing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
/*! \file imgproc.hpp
|
|
||||||
\brief The Image Processing
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
|||||||
@@ -548,7 +548,7 @@ void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter*
|
|||||||
|
|
||||||
struct ConversionYUV
|
struct ConversionYUV
|
||||||
{
|
{
|
||||||
ConversionYUV( const int code )
|
explicit ConversionYUV( const int code )
|
||||||
{
|
{
|
||||||
yuvReader_ = YUVreader :: getReader(code);
|
yuvReader_ = YUVreader :: getReader(code);
|
||||||
yuvWriter_ = YUVwriter :: getWriter(code);
|
yuvWriter_ = YUVwriter :: getWriter(code);
|
||||||
@@ -557,6 +557,24 @@ struct ConversionYUV
|
|||||||
grayWriter_ = GRAYwriter:: getWriter(code);
|
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()
|
int getDcn()
|
||||||
{
|
{
|
||||||
return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());
|
return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());
|
||||||
|
|||||||
@@ -501,6 +501,8 @@ _exit_:
|
|||||||
comp[6] = s1;
|
comp[6] = s1;
|
||||||
comp[7] = s2;
|
comp[7] = s2;
|
||||||
comp[8] = 0;
|
comp[8] = 0;
|
||||||
|
|
||||||
|
cvReleaseMemStorage(&st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1372,17 +1372,65 @@ void CV_GetQuadSubPixTest::prepare_to_validation( int /*test_case_idx*/ )
|
|||||||
dst.convertTo(dst0, dst0.depth());
|
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)
|
TEST(Imgproc_cvWarpAffine, regression)
|
||||||
{
|
{
|
||||||
IplImage* src = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
|
IplImage* src = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
|
||||||
IplImage* dst = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
|
IplImage* dst = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
|
||||||
|
|
||||||
|
cvZero(src);
|
||||||
|
|
||||||
float m[6];
|
float m[6];
|
||||||
CvMat M = cvMat( 2, 3, CV_32F, m );
|
CvMat M = cvMat( 2, 3, CV_32F, m );
|
||||||
int w = src->width;
|
int w = src->width;
|
||||||
int h = src->height;
|
int h = src->height;
|
||||||
cv2DRotationMatrix(cvPoint2D32f(w*0.5f, h*0.5f), 45.0, 1.0, &M);
|
cv2DRotationMatrix(cvPoint2D32f(w*0.5f, h*0.5f), 45.0, 1.0, &M);
|
||||||
cvWarpAffine(src, dst, &M);
|
cvWarpAffine(src, dst, &M);
|
||||||
|
|
||||||
|
cvReleaseImage(&src);
|
||||||
|
cvReleaseImage(&dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Imgproc_fitLine_vector_3d, regression)
|
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);
|
cv::resize(src, actual, cv::Size(), 0.3, 0.3, INTER_AREA);
|
||||||
|
|
||||||
ASSERT_EQ(actual.type(), expected.type());
|
check_resize_area<ushort>(expected, actual, 1.0);
|
||||||
ASSERT_EQ(actual.size(), expected.size());
|
}
|
||||||
|
|
||||||
Mat diff;
|
TEST(Imgproc_resize_area, regression_half_round)
|
||||||
absdiff(actual, expected, diff);
|
{
|
||||||
|
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;
|
cv::Mat src(32, 32, CV_8UC1, input_data);
|
||||||
Size dsize = actual.size();
|
cv::Mat expected(16, 16, CV_8UC1, expected_data);
|
||||||
bool next = true;
|
cv::Mat actual(expected.size(), expected.type());
|
||||||
for (int dy = 0; dy < dsize.height && next; ++dy)
|
|
||||||
{
|
|
||||||
ushort* eD = expected.ptr<ushort>(dy);
|
|
||||||
ushort* aD = actual.ptr<ushort>(dy);
|
|
||||||
|
|
||||||
for (int dx = 0; dx < dsize.width && next; ++dx)
|
cv::resize(src, actual, cv::Size(), 0.5, 0.5, INTER_AREA);
|
||||||
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);
|
|
||||||
|
|
||||||
const int radius = 3;
|
check_resize_area<uchar>(expected, actual, 0.5);
|
||||||
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;
|
TEST(Imgproc_resize_area, regression_quarter_round)
|
||||||
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;
|
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_Remap_Test::CV_Remap_Test() :
|
||||||
CV_ImageWarpBaseTest(), mapx(), mapy(),
|
CV_ImageWarpBaseTest(), borderType(-1)
|
||||||
borderType(-1), borderValue()
|
|
||||||
{
|
{
|
||||||
funcs[0] = &CV_Remap_Test::remap_nearest;
|
funcs[0] = &CV_Remap_Test::remap_nearest;
|
||||||
funcs[1] = &CV_Remap_Test::remap_generic;
|
funcs[1] = &CV_Remap_Test::remap_generic;
|
||||||
@@ -666,7 +665,7 @@ void CV_Remap_Test::generate_test_data()
|
|||||||
// generating the mapx, mapy matrices
|
// generating the mapx, mapy matrices
|
||||||
static const int mapx_types[] = { CV_16SC2, CV_32FC1, CV_32FC2 };
|
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))]);
|
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);
|
const int n = std::min(std::min(src.cols, src.rows) / 10 + 1, 2);
|
||||||
float _n = 0; //static_cast<float>(-n);
|
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>();
|
MatIterator_<ushort> begin_y = mapy.begin<ushort>(), end_y = mapy.end<ushort>();
|
||||||
for ( ; begin_y != end_y; ++begin_y)
|
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;
|
break;
|
||||||
|
|
||||||
@@ -701,7 +700,7 @@ void CV_Remap_Test::generate_test_data()
|
|||||||
{
|
{
|
||||||
MatIterator_<short> begin_y = mapy.begin<short>(), end_y = mapy.end<short>();
|
MatIterator_<short> begin_y = mapy.begin<short>(), end_y = mapy.end<short>();
|
||||||
for ( ; begin_y != end_y; ++begin_y)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@@ -718,8 +717,8 @@ void CV_Remap_Test::generate_test_data()
|
|||||||
MatIterator_<float> begin_y = mapy.begin<float>();
|
MatIterator_<float> begin_y = mapy.begin<float>();
|
||||||
for ( ; begin_x != end_x; ++begin_x, ++begin_y)
|
for ( ; begin_x != end_x; ++begin_x, ++begin_y)
|
||||||
{
|
{
|
||||||
begin_x[0] = rng.uniform(_n, fscols);
|
*begin_x = rng.uniform(_n, fscols);
|
||||||
begin_y[0] = rng.uniform(_n, fsrows);
|
*begin_y = rng.uniform(_n, fsrows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -731,8 +730,8 @@ void CV_Remap_Test::generate_test_data()
|
|||||||
fsrows = static_cast<float>(std::max(src.rows - 1 + n, 0));
|
fsrows = static_cast<float>(std::max(src.rows - 1 + n, 0));
|
||||||
for ( ; begin_x != end_x; ++begin_x)
|
for ( ; begin_x != end_x; ++begin_x)
|
||||||
{
|
{
|
||||||
begin_x[0] = rng.uniform(_n, fscols);
|
(*begin_x)[0] = rng.uniform(_n, fscols);
|
||||||
begin_x[1] = rng.uniform(_n, fsrows);
|
(*begin_x)[1] = rng.uniform(_n, fsrows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -777,23 +776,6 @@ void CV_Remap_Test::prepare_test_data_for_reference_func()
|
|||||||
{
|
{
|
||||||
CV_ImageWarpBaseTest::prepare_test_data_for_reference_func();
|
CV_ImageWarpBaseTest::prepare_test_data_for_reference_func();
|
||||||
convert_maps();
|
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()
|
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" );
|
_layer_sizes = (CvMat*)cvReadByName( fs, node, "layer_sizes" );
|
||||||
CV_CALL( create( _layer_sizes, SIGMOID_SYM, 0, 0 ));
|
CV_CALL( create( _layer_sizes, SIGMOID_SYM, 0, 0 ));
|
||||||
|
|
||||||
|
cvReleaseMat( &_layer_sizes );
|
||||||
|
_layer_sizes = NULL;
|
||||||
|
|
||||||
l_count = layer_sizes->cols;
|
l_count = layer_sizes->cols;
|
||||||
|
|
||||||
CV_CALL( read_params( fs, node ));
|
CV_CALL( read_params( fs, node ));
|
||||||
|
|||||||
@@ -537,6 +537,9 @@ void CvERTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
|
|||||||
if( data )
|
if( data )
|
||||||
delete data;
|
delete data;
|
||||||
|
|
||||||
|
if ( pair16u32s_ptr )
|
||||||
|
cvFree( &pair16u32s_ptr );
|
||||||
|
|
||||||
if (_fdst)
|
if (_fdst)
|
||||||
cvFree( &_fdst );
|
cvFree( &_fdst );
|
||||||
if (_idst)
|
if (_idst)
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag,
|
|||||||
for (int i=1; i<n; ++i)
|
for (int i=1; i<n; ++i)
|
||||||
{
|
{
|
||||||
int k = 0;
|
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++;
|
k++;
|
||||||
if (k == j)
|
if (k == j)
|
||||||
{
|
{
|
||||||
@@ -1292,13 +1292,18 @@ CvGBTrees::calc_error( CvMLData* _data, int type, std::vector<float> *resp )
|
|||||||
return -FLT_MAX;
|
return -FLT_MAX;
|
||||||
|
|
||||||
float* pred_resp = 0;
|
float* pred_resp = 0;
|
||||||
|
bool needsFreeing = false;
|
||||||
|
|
||||||
if (resp)
|
if (resp)
|
||||||
{
|
{
|
||||||
resp->resize(n);
|
resp->resize(n);
|
||||||
pred_resp = &((*resp)[0]);
|
pred_resp = &((*resp)[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pred_resp = new float[n];
|
pred_resp = new float[n];
|
||||||
|
needsFreeing = true;
|
||||||
|
}
|
||||||
|
|
||||||
Sample_predictor predictor = Sample_predictor(this, pred_resp, _data->get_values(),
|
Sample_predictor predictor = Sample_predictor(this, pred_resp, _data->get_values(),
|
||||||
_data->get_missing(), _sample_idx);
|
_data->get_missing(), _sample_idx);
|
||||||
@@ -1331,6 +1336,9 @@ CvGBTrees::calc_error( CvMLData* _data, int type, std::vector<float> *resp )
|
|||||||
err = err / (float)n;
|
err = err / (float)n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needsFreeing)
|
||||||
|
delete[]pred_resp;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -777,7 +777,8 @@ cvGetTrainSamples( const CvMat* train_data, int tflag,
|
|||||||
|
|
||||||
__BEGIN__;
|
__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;
|
bool copy_data;
|
||||||
const float* data;
|
const float* data;
|
||||||
const int *s_idx, *v_idx;
|
const int *s_idx, *v_idx;
|
||||||
@@ -815,7 +816,7 @@ cvGetTrainSamples( const CvMat* train_data, int tflag,
|
|||||||
{
|
{
|
||||||
samples[0] = (float*)(samples + sample_count);
|
samples[0] = (float*)(samples + sample_count);
|
||||||
if( tflag != CV_ROW_SAMPLE )
|
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++ )
|
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;
|
params.svm_type == CvSVM::ONE_CLASS ? 1 : 0;
|
||||||
const CvSVMDecisionFunc* df = decision_func;
|
const CvSVMDecisionFunc* df = decision_func;
|
||||||
if( !isSvmModelApplicable(sv_total, var_all, var_count, class_count) )
|
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" );
|
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 );
|
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):
|
def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR):
|
||||||
if not filename in self.image_cache:
|
if not filename in self.image_cache:
|
||||||
filedata = urllib.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
|
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]
|
return self.image_cache[filename]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ BadArgTest::BadArgTest()
|
|||||||
progress = -1;
|
progress = -1;
|
||||||
test_case_idx = -1;
|
test_case_idx = -1;
|
||||||
freq = cv::getTickFrequency();
|
freq = cv::getTickFrequency();
|
||||||
|
t = -1;
|
||||||
// oldErrorCbk = 0;
|
// oldErrorCbk = 0;
|
||||||
// oldErrorCbkData = 0;
|
// oldErrorCbkData = 0;
|
||||||
}
|
}
|
||||||
@@ -338,6 +339,7 @@ int BadArgTest::run_test_case( int expected_code, const string& _descr )
|
|||||||
{
|
{
|
||||||
test_case_idx = 0;
|
test_case_idx = 0;
|
||||||
progress = 0;
|
progress = 0;
|
||||||
|
t = 0;
|
||||||
dt = 0;
|
dt = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ endif()
|
|||||||
if(INSTALL_C_EXAMPLES)
|
if(INSTALL_C_EXAMPLES)
|
||||||
install(FILES "CMakeLists.txt"
|
install(FILES "CMakeLists.txt"
|
||||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}
|
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()
|
endif()
|
||||||
|
|
||||||
if(INSTALL_PYTHON_EXAMPLES)
|
if(INSTALL_PYTHON_EXAMPLES)
|
||||||
@@ -68,8 +68,14 @@ endif()
|
|||||||
|
|
||||||
add_subdirectory(c)
|
add_subdirectory(c)
|
||||||
add_subdirectory(cpp)
|
add_subdirectory(cpp)
|
||||||
add_subdirectory(ocl)
|
ocv_check_dependencies(opencv_ocl)
|
||||||
add_subdirectory(gpu)
|
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
|
# 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
|
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)
|
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib)
|
||||||
|
|
||||||
ocv_check_dependencies(${OPENCV_C_SAMPLES_REQUIRED_DEPS})
|
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")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ocv_include_modules(${OPENCV_C_SAMPLES_REQUIRED_DEPS})
|
ocv_include_modules(${OPENCV_C_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
|
||||||
|
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
# Define executable targets
|
# Define executable targets
|
||||||
@@ -52,8 +52,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
|
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}
|
install(FILES ${C_SAMPLES}
|
||||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c
|
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c"
|
||||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
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 ()
|
endif ()
|
||||||
|
|||||||
+24
-10
@@ -4,19 +4,31 @@
|
|||||||
* Author: Liu Liu
|
* Author: Liu Liu
|
||||||
* liuliu.1987+opencv@gmail.com
|
* 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 "opencv2/opencv_modules.hpp"
|
||||||
#include <vector>
|
|
||||||
#include <stdio.h>
|
#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;
|
using namespace std;
|
||||||
static void help()
|
static void help()
|
||||||
{
|
{
|
||||||
@@ -320,3 +332,5 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,12 +1,25 @@
|
|||||||
#include "opencv2/highgui/highgui.hpp"
|
#include "opencv2/opencv_modules.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 <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 std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
@@ -164,3 +177,5 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -7,16 +7,28 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
#include <stdio.h>
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
|
||||||
#include "opencv2/imgproc/imgproc_c.h"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
|
||||||
#include "opencv2/legacy/legacy.hpp"
|
int main(int, char**)
|
||||||
#include "opencv2/legacy/compat.hpp"
|
{
|
||||||
|
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 <string>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
static void help()
|
static void help()
|
||||||
{
|
{
|
||||||
@@ -116,3 +128,5 @@ Mat DrawCorrespondences(const Mat& img1, const vector<KeyPoint>& features1, cons
|
|||||||
|
|
||||||
return img_corr;
|
return img_corr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc
|
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_highgui opencv_ml opencv_video opencv_objdetect opencv_photo
|
||||||
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_stitching opencv_videostab)
|
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib
|
||||||
|
opencv_stitching opencv_videostab)
|
||||||
|
|
||||||
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
|||||||
project(cpp_samples)
|
project(cpp_samples)
|
||||||
|
|
||||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/include")#for opencv.hpp
|
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)
|
if(HAVE_opencv_gpu)
|
||||||
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include")
|
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)
|
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.* build_all.sh *.dsp *.cmd *.txt)
|
||||||
install(FILES ${C_SAMPLES}
|
install(FILES ${C_SAMPLES}
|
||||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp
|
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp"
|
||||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,29 +1,41 @@
|
|||||||
#include "opencv2/opencv_modules.hpp"
|
#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 <iostream>
|
||||||
#include <memory>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#if defined WIN32 || defined _WIN32
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#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
|
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 cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -2623,3 +2635,5 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
#include "opencv2/highgui/highgui.hpp"
|
||||||
#include "opencv2/calib3d/calib3d.hpp"
|
#include "opencv2/calib3d/calib3d.hpp"
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
#include "opencv2/features2d/features2d.hpp"
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
#ifdef HAVE_OPENCV_NONFREE
|
||||||
|
# include "opencv2/nonfree/nonfree.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#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"
|
<< "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"
|
<< argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image] [evaluate(0 or 1)]\n"
|
||||||
<< "Example of case1:\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"
|
<< "\n"
|
||||||
<< "Case2: both images are given. If ransacReprojThreshold>=0 then homography matrix are calculated\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"
|
<< argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image1] [image2] [ransacReprojThreshold]\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "Matches are filtered using homography matrix in case1 and case2 (if ransacReprojThreshold>=0)\n"
|
<< "Matches are filtered using homography matrix in case1 and case2 (if ransacReprojThreshold>=0)\n"
|
||||||
<< "Example of case2:\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"
|
<< "\n"
|
||||||
<< "Possible detectorType values: see in documentation on createFeatureDetector().\n"
|
<< "Possible detectorType values: see in documentation on createFeatureDetector().\n"
|
||||||
<< "Possible descriptorType values: see in documentation on createDescriptorExtractor().\n"
|
<< "Possible descriptorType values: see in documentation on createDescriptorExtractor().\n"
|
||||||
@@ -239,7 +242,11 @@ int main(int argc, char** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENCV_NONFREE
|
||||||
cv::initModule_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;
|
bool isWarpPerspective = argc == 7;
|
||||||
double ransacReprojThreshold = -1;
|
double ransacReprojThreshold = -1;
|
||||||
|
|||||||
@@ -49,9 +49,21 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "opencv2/opencv.hpp"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
|
||||||
|
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 cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -212,3 +224,5 @@ int main(int argc, char * argv[]) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -34,15 +34,27 @@
|
|||||||
// or tort (including negligence or otherwise) arising in any way out of
|
// 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.
|
// the use of this software, even if advised of the possibility of such damage.
|
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <opencv2/core/core.hpp>
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
|
||||||
#include <opencv2/features2d/features2d.hpp>
|
int main(int, char**)
|
||||||
#include <opencv2/nonfree/features2d.hpp>
|
{
|
||||||
#include <opencv2/legacy/legacy.hpp>
|
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;
|
using namespace cv;
|
||||||
|
|
||||||
@@ -126,3 +138,5 @@ int main( int argc, char** argv ) {
|
|||||||
imshow("matches", imgMatch);
|
imshow("matches", imgMatch);
|
||||||
waitKey(0);
|
waitKey(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
#include "opencv2/calib3d/calib3d.hpp"
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
|
||||||
|
|
||||||
#include <cstdio>
|
#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;
|
using namespace cv;
|
||||||
|
|
||||||
static void help()
|
static void help()
|
||||||
@@ -91,3 +103,5 @@ Mat DrawCorrespondences(const Mat& img1, const vector<KeyPoint>& features1, cons
|
|||||||
|
|
||||||
return img_corr;
|
return img_corr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,8 +1,20 @@
|
|||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "opencv2/core/core.hpp"
|
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
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;
|
using namespace cv;
|
||||||
|
|
||||||
@@ -56,3 +68,5 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -4,12 +4,23 @@
|
|||||||
* @author A. Huaman
|
* @author A. Huaman
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
|
||||||
#include "opencv2/core/core.hpp"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
int main(int, char**)
|
||||||
#include "opencv2/nonfree/features2d.hpp"
|
{
|
||||||
|
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;
|
using namespace cv;
|
||||||
|
|
||||||
@@ -28,7 +39,7 @@ int main( int argc, char** argv )
|
|||||||
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
|
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
|
||||||
|
|
||||||
if( !img_1.data || !img_2.data )
|
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
|
//-- Step 1: Detect the keypoints using SURF Detector
|
||||||
int minHessian = 400;
|
int minHessian = 400;
|
||||||
@@ -97,4 +108,6 @@ int main( int argc, char** argv )
|
|||||||
* @function readme
|
* @function readme
|
||||||
*/
|
*/
|
||||||
void 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
|
* @author A. Huaman
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
|
||||||
#include "opencv2/core/core.hpp"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
int main(int, char**)
|
||||||
#include "opencv2/calib3d/calib3d.hpp"
|
{
|
||||||
#include "opencv2/nonfree/features2d.hpp"
|
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;
|
using namespace cv;
|
||||||
|
|
||||||
@@ -29,7 +40,7 @@ int main( int argc, char** argv )
|
|||||||
Mat img_scene = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
|
Mat img_scene = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
|
||||||
|
|
||||||
if( !img_object.data || !img_scene.data )
|
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
|
//-- Step 1: Detect the keypoints using SURF Detector
|
||||||
int minHessian = 400;
|
int minHessian = 400;
|
||||||
@@ -121,4 +132,6 @@ int main( int argc, char** argv )
|
|||||||
* @function readme
|
* @function readme
|
||||||
*/
|
*/
|
||||||
void 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
|
* @author A. Huaman
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
|
||||||
#include "opencv2/core/core.hpp"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
int main(int, char**)
|
||||||
#include "opencv2/nonfree/features2d.hpp"
|
{
|
||||||
|
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;
|
using namespace cv;
|
||||||
|
|
||||||
@@ -69,4 +80,6 @@ int main( int argc, char** argv )
|
|||||||
* @function readme
|
* @function readme
|
||||||
*/
|
*/
|
||||||
void 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
|
* @author A. Huaman
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "opencv2/core/core.hpp"
|
|
||||||
#include "opencv2/features2d/features2d.hpp"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
|
||||||
#include "opencv2/nonfree/features2d.hpp"
|
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;
|
using namespace cv;
|
||||||
|
|
||||||
@@ -60,3 +71,5 @@ int main( int argc, char** argv )
|
|||||||
*/
|
*/
|
||||||
void readme()
|
void readme()
|
||||||
{ std::cout << " Usage: ./SURF_detector <img1> <img2>" << std::endl; }
|
{ 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")
|
list_filterout(install_list ".*driver_api_stereo_multi.cpp")
|
||||||
endif()
|
endif()
|
||||||
install(FILES ${install_list}
|
install(FILES ${install_list}
|
||||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu
|
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu"
|
||||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ endif()
|
|||||||
if(INSTALL_C_EXAMPLES AND NOT WIN32)
|
if(INSTALL_C_EXAMPLES AND NOT WIN32)
|
||||||
file(GLOB GPU_FILES performance/*.cpp performance/*.h performance/CMakeLists.txt)
|
file(GLOB GPU_FILES performance/*.cpp performance/*.h performance/CMakeLists.txt)
|
||||||
install(FILES ${GPU_FILES}
|
install(FILES ${GPU_FILES}
|
||||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu/performance
|
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu/performance"
|
||||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||||
COMPONENT samples)
|
COMPONENT samples)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
SET(OPENCV_OCL_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui
|
SET(OPENCV_OCL_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui
|
||||||
opencv_ml opencv_video opencv_objdetect opencv_features2d
|
opencv_ml opencv_video opencv_objdetect opencv_features2d
|
||||||
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl
|
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl)
|
||||||
opencv_nonfree)
|
|
||||||
|
|
||||||
ocv_check_dependencies(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
|
ocv_check_dependencies(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
|||||||
|
|
||||||
project("${project}_samples")
|
project("${project}_samples")
|
||||||
|
|
||||||
ocv_include_modules(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
|
ocv_include_modules(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
|
||||||
|
|
||||||
if(HAVE_OPENCL)
|
if(HAVE_OPENCL)
|
||||||
ocv_include_directories(${OPENCL_INCLUDE_DIR})
|
ocv_include_directories(${OPENCL_INCLUDE_DIR})
|
||||||
@@ -52,8 +51,8 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
|
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}
|
install(FILES ${install_list}
|
||||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl
|
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl"
|
||||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
|
||||||
#include "opencv2/core/core.hpp"
|
#ifndef HAVE_OPENCV_NONFREE
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
|
||||||
#include "opencv2/ocl/ocl.hpp"
|
int main(int, char**)
|
||||||
#include "opencv2/nonfree/ocl.hpp"
|
{
|
||||||
#include "opencv2/calib3d/calib3d.hpp"
|
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
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;
|
||||||
using namespace cv::ocl;
|
using namespace cv::ocl;
|
||||||
@@ -326,3 +337,5 @@ int main(int argc, char* argv[])
|
|||||||
waitKey(0);
|
waitKey(0);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user