Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
a91a11e5
Commit
a91a11e5
authored
Feb 13, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10818 from mshabunin:install-samples-src
parents
2423cddb
c6309278
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
482 additions
and
682 deletions
+482
-682
CMakeLists.txt
CMakeLists.txt
+2
-2
OpenCVExtraTargets.cmake
cmake/OpenCVExtraTargets.cmake
+8
-0
OpenCVModule.cmake
cmake/OpenCVModule.cmake
+23
-13
opengl.cpp
modules/core/src/opengl.cpp
+31
-42
CMakeLists.txt
samples/CMakeLists.txt
+72
-27
CMakeLists.txt
samples/cpp/CMakeLists.txt
+56
-108
application_trace.cpp
samples/cpp/application_trace.cpp
+3
-1
autofocus.cpp
samples/cpp/autofocus.cpp
+3
-1
detect_blob.cpp
samples/cpp/detect_blob.cpp
+4
-1
detect_mser.cpp
samples/cpp/detect_mser.cpp
+4
-2
matchmethod_orb_akaze_brisk.cpp
samples/cpp/matchmethod_orb_akaze_brisk.cpp
+4
-1
train_svmsgd.cpp
samples/cpp/train_svmsgd.cpp
+4
-3
travelsalesman.cpp
samples/cpp/travelsalesman.cpp
+4
-1
Morphology_3.cpp
...orial_code/ImgProc/morph_lines_detection/Morphology_3.cpp
+4
-1
imageSegmentation.cpp
samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp
+3
-1
camera_calibration.cpp
...al_code/calib3d/camera_calibration/camera_calibration.cpp
+0
-5
CMakeLists.txt
...ial_code/calib3d/real_time_pose_estimation/CMakeLists.txt
+3
-1
CsvWriter.h
...al_code/calib3d/real_time_pose_estimation/src/CsvWriter.h
+1
-1
ModelRegistration.h
...calib3d/real_time_pose_estimation/src/ModelRegistration.h
+1
-1
planar_tracking.cpp
...torial_code/features2D/AKAZE_tracking/planar_tracking.cpp
+2
-1
decompose_homography.cpp
...orial_code/features2D/Homography/decompose_homography.cpp
+4
-1
homography_from_camera_displacement.cpp
...ures2D/Homography/homography_from_camera_displacement.cpp
+4
-1
panorama_stitching_rotating_camera.cpp
...tures2D/Homography/panorama_stitching_rotating_camera.cpp
+4
-1
perspective_correction.cpp
...ial_code/features2D/Homography/perspective_correction.cpp
+4
-27
pose_from_homography.cpp
...orial_code/features2D/Homography/pose_from_homography.cpp
+4
-1
core_various.cpp
samples/cpp/tutorial_code/snippets/core_various.cpp
+4
-1
imgcodecs_imwrite.cpp
samples/cpp/tutorial_code/snippets/imgcodecs_imwrite.cpp
+1
-1
imgproc_HoughLinesPointSet.cpp
...cpp/tutorial_code/snippets/imgproc_HoughLinesPointSet.cpp
+2
-1
histo3D.cpp
samples/cpp/tutorial_code/viz/histo3D.cpp
+5
-1
LATCH_match.cpp
samples/cpp/tutorial_code/xfeatures2D/LATCH_match.cpp
+3
-1
videocapture_basic.cpp
samples/cpp/videocapture_basic.cpp
+4
-3
videowriter_basic.cpp
samples/cpp/videowriter_basic.cpp
+4
-3
CMakeLists.txt
samples/directx/CMakeLists.txt
+18
-42
CMakeLists.txt
samples/dnn/CMakeLists.txt
+34
-71
CMakeLists.txt
samples/gpu/CMakeLists.txt
+53
-90
CMakeLists.txt
samples/gpu/performance/CMakeLists.txt
+1
-7
CMakeLists.txt
samples/opencl/CMakeLists.txt
+28
-62
opencl-opencv-interop.cpp
samples/opencl/opencl-opencv-interop.cpp
+1
-1
CMakeLists.txt
samples/opengl/CMakeLists.txt
+12
-39
CMakeLists.txt
samples/openvx/CMakeLists.txt
+20
-32
CMakeLists.txt
samples/tapi/CMakeLists.txt
+22
-48
CMakeLists.txt
samples/va_intel/CMakeLists.txt
+18
-35
No files found.
CMakeLists.txt
View file @
a91a11e5
...
...
@@ -420,7 +420,7 @@ else()
ocv_update
(
OPENCV_LIB_INSTALL_PATH
"
${
OpenCV_INSTALL_BINARIES_PREFIX
}
lib
${
LIB_SUFFIX
}
"
)
endif
()
ocv_update
(
OPENCV_3P_LIB_INSTALL_PATH
"
${
OpenCV_INSTALL_BINARIES_PREFIX
}
staticlib
${
LIB_SUFFIX
}
"
)
ocv_update
(
OPENCV_SAMPLES_SRC_INSTALL_PATH samples
/native
)
ocv_update
(
OPENCV_SAMPLES_SRC_INSTALL_PATH samples
)
ocv_update
(
OPENCV_JAR_INSTALL_PATH java
)
ocv_update
(
OPENCV_OTHER_INSTALL_PATH etc
)
ocv_update
(
OPENCV_CONFIG_INSTALL_PATH
"."
)
...
...
@@ -804,7 +804,7 @@ if(BUILD_opencv_apps)
endif
()
# examples
if
(
BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES
)
if
(
BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES
OR INSTALL_C_EXAMPLES
)
add_subdirectory
(
samples
)
endif
()
...
...
cmake/OpenCVExtraTargets.cmake
View file @
a91a11e5
...
...
@@ -43,3 +43,11 @@ if(BUILD_DOCS)
add_custom_target
(
install_docs DEPENDS opencv_docs
COMMAND
"
${
CMAKE_COMMAND
}
"
-DCMAKE_INSTALL_COMPONENT=docs -P
"
${
CMAKE_BINARY_DIR
}
/cmake_install.cmake"
)
endif
()
# Samples
if
(
BUILD_EXAMPLES
)
add_custom_target
(
opencv_samples
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
opencv_samples PROPERTIES FOLDER
"extra"
)
endif
()
endif
()
cmake/OpenCVModule.cmake
View file @
a91a11e5
...
...
@@ -1221,9 +1221,13 @@ function(ocv_add_samples)
ocv_debug_message
(
"ocv_add_samples("
${
ARGN
}
")"
)
set
(
samples_path
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/samples"
)
if
(
NOT EXISTS
"
${
samples_path
}
"
)
return
()
endif
()
string
(
REGEX REPLACE
"^opencv_"
""
module_id
${
the_module
}
)
if
(
BUILD_EXAMPLES
AND EXISTS
"
${
samples_path
}
"
)
if
(
BUILD_EXAMPLES
)
set
(
samples_deps
${
the_module
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
opencv_imgcodecs opencv_videoio opencv_highgui
${
ARGN
}
)
ocv_check_dependencies
(
${
samples_deps
}
)
...
...
@@ -1237,17 +1241,23 @@ function(ocv_add_samples)
ocv_add_executable
(
${
the_target
}
"
${
source
}
"
)
ocv_target_include_modules
(
${
the_target
}
${
samples_deps
}
)
ocv_target_link_libraries
(
${
the_target
}
LINK_PRIVATE
${
samples_deps
}
)
set_target_properties
(
${
the_target
}
PROPERTIES PROJECT_LABEL
"(sample)
${
name
}
"
)
set_target_properties
(
${
the_target
}
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;Sample"
)
set_source_files_properties
(
"
${
source
}
"
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;Sample"
)
set_target_properties
(
${
the_target
}
PROPERTIES
PROJECT_LABEL
"(sample)
${
name
}
"
LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;Sample"
)
set_source_files_properties
(
"
${
source
}
"
PROPERTIES
LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;Sample"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
module_id
}
-example-
${
name
}
"
FOLDER
"samples/
${
module_id
}
"
)
endif
()
# Add single target to build all samples for the module: 'make opencv_samples_bioinspired'
set
(
parent_target opencv_samples_
${
module_id
}
)
if
(
NOT TARGET
${
parent_target
}
)
add_custom_target
(
${
parent_target
}
)
add_dependencies
(
opencv_samples
${
parent_target
}
)
endif
()
add_dependencies
(
${
parent_target
}
${
the_target
}
)
if
(
WIN32
)
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"samples/
${
module_id
}
"
COMPONENT samples
)
...
...
@@ -1256,8 +1266,8 @@ function(ocv_add_samples)
endif
()
endif
()
if
(
INSTALL_C_EXAMPLES
AND NOT WIN32 AND EXISTS
"
${
samples_path
}
"
)
file
(
GLOB DEPLOY_FILES_AND_DIRS
"
${
samples_path
}
/*"
)
if
(
INSTALL_C_EXAMPLES
)
file
(
GLOB DEPLOY_FILES_AND_DIRS
"
${
samples_path
}
/*"
)
foreach
(
ITEM
${
DEPLOY_FILES_AND_DIRS
}
)
IF
(
IS_DIRECTORY
"
${
ITEM
}
"
)
LIST
(
APPEND sample_dirs
"
${
ITEM
}
"
)
...
...
@@ -1266,10 +1276,10 @@ function(ocv_add_samples)
ENDIF
()
endforeach
()
install
(
FILES
${
sample_files
}
DESTINATION
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/
${
module_id
}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
COMPONENT samples
)
DESTINATION
"
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/
${
module_id
}
"
COMPONENT samples
)
install
(
DIRECTORY
${
sample_dirs
}
DESTINATION
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/
${
module_id
}
USE_SOURCE_PERMISSIONS
COMPONENT samples
)
DESTINATION
"
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/
${
module_id
}
"
COMPONENT samples
)
endif
()
endfunction
()
modules/core/src/opengl.cpp
View file @
a91a11e5
...
...
@@ -56,53 +56,42 @@ using namespace cv::cuda;
namespace
{
#ifndef HAVE_OPENGL
inline
void
throw_no_ogl
()
{
CV_Error
(
cv
::
Error
::
OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
}
#else
inline
void
throw_no_ogl
()
{
CV_Error
(
cv
::
Error
::
OpenGlApiCallError
,
"OpenGL context doesn't exist"
);
}
bool
checkError
(
const
char
*
file
,
const
int
line
,
const
char
*
func
=
0
)
#ifndef HAVE_OPENGL
inline
static
void
throw_no_ogl
()
{
CV_Error
(
cv
::
Error
::
OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
}
#elif defined _DEBUG
inline
static
bool
checkError
(
const
char
*
file
,
const
int
line
,
const
char
*
func
=
0
)
{
GLenum
err
=
gl
::
GetError
();
if
(
err
!=
gl
::
NO_ERROR_
)
{
GLenum
err
=
gl
::
GetError
();
if
(
err
!=
gl
::
NO_ERROR_
)
const
char
*
msg
;
switch
(
err
)
{
const
char
*
msg
;
switch
(
err
)
{
case
gl
:
:
INVALID_ENUM
:
msg
=
"An unacceptable value is specified for an enumerated argument"
;
break
;
case
gl
:
:
INVALID_VALUE
:
msg
=
"A numeric argument is out of range"
;
break
;
case
gl
:
:
INVALID_OPERATION
:
msg
=
"The specified operation is not allowed in the current state"
;
break
;
case
gl
:
:
OUT_OF_MEMORY
:
msg
=
"There is not enough memory left to execute the command"
;
break
;
default
:
msg
=
"Unknown error"
;
};
cvError
(
CV_OpenGlApiCallError
,
func
,
msg
,
file
,
line
);
return
false
;
}
return
true
;
case
gl
:
:
INVALID_ENUM
:
msg
=
"An unacceptable value is specified for an enumerated argument"
;
break
;
case
gl
:
:
INVALID_VALUE
:
msg
=
"A numeric argument is out of range"
;
break
;
case
gl
:
:
INVALID_OPERATION
:
msg
=
"The specified operation is not allowed in the current state"
;
break
;
case
gl
:
:
OUT_OF_MEMORY
:
msg
=
"There is not enough memory left to execute the command"
;
break
;
default
:
msg
=
"Unknown error"
;
};
cvError
(
CV_OpenGlApiCallError
,
func
,
msg
,
file
,
line
);
return
false
;
}
#endif
#define CV_CheckGlError() CV_DbgAssert( (checkError(__FILE__, __LINE__, CV_Func)) )
return
true
;
}
#endif // HAVE_OPENGL
}
// namespace
#define CV_CheckGlError() CV_DbgAssert( (checkError(__FILE__, __LINE__, CV_Func)) )
#ifdef HAVE_OPENGL
namespace
{
...
...
samples/CMakeLists.txt
View file @
a91a11e5
# Detect if we want to build samples with library binaries or not
# Utility function: adds sample executable target with name "example_<group>_<file_name>"
# Usage:
# ocv_define_sample(<output target> <relative filename> <group>)
function
(
ocv_define_sample out_target source sub
)
get_filename_component
(
name
"
${
source
}
"
NAME_WE
)
set
(
the_target
"example_
${
sub
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
"
${
source
}
"
)
set_target_properties
(
${
the_target
}
PROPERTIES PROJECT_LABEL
"(sample)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples/
${
sub
}
"
)
endif
()
if
(
WIN32 AND MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
if
(
WIN32
)
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"samples/
${
sub
}
"
COMPONENT samples
)
endif
()
# Add single target to build all samples in the group: 'make opencv_samples_cpp'
set
(
parent_target opencv_samples_
${
sub
}
)
if
(
NOT TARGET
${
parent_target
}
)
add_custom_target
(
${
parent_target
}
)
if
(
TARGET opencv_samples
)
add_dependencies
(
opencv_samples
${
parent_target
}
)
endif
()
endif
()
add_dependencies
(
${
parent_target
}
${
the_target
}
)
set
(
${
out_target
}
${
the_target
}
PARENT_SCOPE
)
endfunction
()
if
(
NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_LIST_DIR
)
#===================================================================================================
#
# BUILD CASE 1: Build samples with library sources
#
# ----------------------------------------------------------------------------
# CMake file for samples. See root CMakeLists.txt
# Build as part of OpenCV
#
# ----------------------------------------------------------------------------
#===================================================================================================
function
(
ocv_install_example_src relpath
)
if
(
INSTALL_C_EXAMPLES
)
file
(
GLOB files
${
ARGN
}
)
install
(
FILES
${
files
}
DESTINATION
"
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/
${
relpath
}
"
COMPONENT samples
)
endif
()
endfunction
()
add_subdirectory
(
cpp
)
add_subdirectory
(
java/tutorial_code
)
add_subdirectory
(
dnn
)
add_subdirectory
(
gpu
)
add_subdirectory
(
tapi
)
add_subdirectory
(
opencl
)
if
(
WIN32 AND HAVE_DIRECTX
)
add_subdirectory
(
directx
)
endif
()
if
((
NOT ANDROID
)
AND HAVE_OPENGL
)
add_subdirectory
(
opengl
)
endif
()
if
(
HAVE_OPENVX
)
add_subdirectory
(
openvx
)
endif
()
if
(
UNIX AND NOT ANDROID
AND
(
HAVE_VA OR HAVE_VA_INTEL
))
add_subdirectory
(
va_intel
)
endif
()
if
(
ANDROID AND BUILD_ANDROID_EXAMPLES
)
add_subdirectory
(
android
)
endif
()
if
(
INSTALL_PYTHON_EXAMPLES
)
add_subdirectory
(
python
)
endif
()
#
# END OF BUILD CASE 1: Build samples with library sources
#
ocv_install_example_src
(
"."
CMakeLists.txt
)
if
(
INSTALL_C_EXAMPLES
)
install
(
DIRECTORY data
DESTINATION
"
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/data"
COMPONENT samples_data
)
endif
()
else
()
#===================================================================================================
#
#
BUILD CASE 2: Build samples with library binaries
#
Standalone mode
#
#===================================================================================================
cmake_minimum_required
(
VERSION 2.8
)
project
(
samples C CXX
)
option
(
BUILD_EXAMPLES
"Build samples"
ON
)
find_package
(
OpenCV REQUIRED
)
# Assuming following installation folder structure (default for UNIX):
# <install_root>/share/
# └── OpenCV/ <-- OPENCV_CONFIG_INSTALL_PATH
# ├── OpenCVConfig.cmake <-- file to be found by find_package
# ├── ...
# ├── samples/ <-- OPENCV_SAMPLES_SRC_INSTALL_PATH
# │ ├── CMakeLists.txt <-- this file
# │ ├── cpp/
find_package
(
OpenCV REQUIRED PATHS
".."
)
function
(
ocv_install_example_src
)
# not used in this branch
endfunction
()
if
(
MSVC
)
if
(
NOT ENABLE_BUILD_HARDENING
)
...
...
@@ -80,16 +126,15 @@ if(MSVC)
endif
()
add_subdirectory
(
cpp
)
add_subdirectory
(
dnn
)
# FIXIT: can't use cvconfig.h in samples: add_subdirectory(gpu)
add_subdirectory
(
opencl
)
if
(
WIN32
)
add_subdirectory
(
directx
)
endif
()
add_subdirectory
(
dnn
)
# add_subdirectory(gpu)
add_subdirectory
(
opencl
)
# add_subdirectory(opengl)
# add_subdirectory(openvx)
add_subdirectory
(
tapi
)
# add_subdirectory(va_intel)
#
# END OF BUILD CASE 2: Build samples with library binaries
#
endif
()
samples/cpp/CMakeLists.txt
View file @
a91a11e5
# ----------------------------------------------------------------------------
# CMake file for C samples. See root CMakeLists.txt
#
# ----------------------------------------------------------------------------
SET
(
OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_flann
opencv_imgcodecs opencv_videoio opencv_highgui opencv_ml opencv_video
opencv_objdetect opencv_photo opencv_features2d opencv_calib3d
opencv_stitching opencv_videostab opencv_shape
${
OPENCV_MODULES_PUBLIC
}
${
OpenCV_LIB_COMPONENTS
}
)
ocv_install_example_src
(
cpp *.cpp *.hpp CMakeLists.txt
)
set
(
OPENCV_CPP_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_flann
opencv_imgcodecs
opencv_videoio
opencv_highgui
opencv_ml
opencv_video
opencv_objdetect
opencv_photo
opencv_features2d
opencv_calib3d
opencv_stitching
opencv_videostab
opencv_shape
${
OPENCV_MODULES_PUBLIC
}
${
OpenCV_LIB_COMPONENTS
}
)
ocv_check_dependencies
(
${
OPENCV_CPP_SAMPLES_REQUIRED_DEPS
}
)
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
project
(
cpp_samples
)
ocv_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/include"
)
#for opencv.hpp
ocv_include_modules_recurse
(
${
OPENCV_CPP_SAMPLES_REQUIRED_DEPS
}
)
if
(
HAVE_opencv_cudaoptflow
)
ocv_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/cudaoptflow/include"
)
project
(
cpp_samples
)
ocv_include_modules_recurse
(
${
OPENCV_CPP_SAMPLES_REQUIRED_DEPS
}
)
file
(
GLOB_RECURSE cpp_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
if
(
NOT HAVE_OPENGL
)
ocv_list_filterout
(
cpp_samples Qt_sample
)
endif
()
if
(
NOT HAVE_opencv_cudaarithm OR NOT HAVE_opencv_cudafilters
)
ocv_list_filterout
(
cpp_samples
"/gpu/"
)
endif
()
if
(
NOT VTK_USE_FILE
)
ocv_list_filterout
(
cpp_samples
"/viz/"
)
endif
()
if
(
NOT HAVE_IPP_A
)
ocv_list_filterout
(
cpp_samples
"/ippasync/"
)
endif
()
ocv_list_filterout
(
cpp_samples
"real_time_pose_estimation/"
)
foreach
(
sample_filename
${
cpp_samples
}
)
if
(
sample_filename MATCHES
"/viz/"
)
include
(
${
VTK_USE_FILE
}
)
endif
()
if
(
HAVE_opencv_cudaimgproc
)
ocv_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/cudaimgproc/include"
)
set
(
package
"cpp"
)
if
(
sample_filename MATCHES
"tutorial_code"
)
set
(
package
"tutorial"
)
endif
()
if
(
HAVE_opencv_cudaarithm
)
ocv_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/cudaarithm/include"
)
ocv_define_sample
(
tgt
${
sample_filename
}
${
package
}
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_CPP_SAMPLES_REQUIRED_DEPS
}
)
if
(
sample_filename MATCHES
"/gpu/"
AND HAVE_opencv_cudaarithm AND HAVE_opencv_cuda_filters
)
ocv_target_link_libraries
(
${
tgt
}
opencv_cudaarithm opencv_cudafilters
)
endif
()
if
(
HAVE_opencv_cudafilters
)
ocv_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/modules/cudafilters/include"
)
if
(
sample_filename MATCHES
"/viz/"
)
ocv_target_link_libraries
(
${
tgt
}
${
VTK_LIBRARIES
}
)
target_compile_definitions
(
${
tgt
}
PRIVATE -DUSE_VTK
)
endif
()
if
(
CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-unused-function -Wno-missing-declarations"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-unused-function -Wno-missing-declarations"
)
if
(
HAVE_OPENGL AND sample_filename MATCHES
"detect_mser"
)
target_compile_definitions
(
${
tgt
}
PRIVATE HAVE_OPENGL
)
endif
()
endforeach
()
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_CPP_EXAMPLE name srcs
)
if
(
"
${
srcs
}
"
MATCHES
"tutorial_code"
)
set
(
sample_kind tutorial
)
set
(
sample_KIND TUTORIAL
)
set
(
sample_subfolder
"tutorials"
)
else
()
set
(
sample_kind example
)
set
(
sample_KIND EXAMPLE
)
set
(
sample_subfolder
"cpp"
)
endif
()
set
(
the_target
"
${
sample_kind
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_CPP_SAMPLES_REQUIRED_DEPS
}
)
if
(
"
${
srcs
}
"
MATCHES
"gpu/"
)
ocv_target_link_libraries
(
${
the_target
}
opencv_cudaarithm opencv_cudafilters
)
endif
()
if
(
"
${
srcs
}
"
MATCHES
"viz/"
AND VTK_USE_FILE
)
include
(
${
VTK_USE_FILE
}
)
ocv_target_link_libraries
(
${
the_target
}
${
VTK_LIBRARIES
}
)
add_definitions
(
-DUSE_VTK
)
endif
()
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"cpp-
${
sample_kind
}
-
${
name
}
"
PROJECT_LABEL
"(
${
sample_KIND
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples/
${
sample_subfolder
}
"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/
${
sample_subfolder
}
"
COMPONENT samples
)
endif
()
ENDMACRO
()
file
(
GLOB_RECURSE cpp_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
if
(
NOT HAVE_OPENGL
)
ocv_list_filterout
(
cpp_samples Qt_sample
)
endif
()
if
(
NOT HAVE_opencv_cudaarithm OR NOT HAVE_opencv_cudafilters
)
ocv_list_filterout
(
cpp_samples
"/gpu/"
)
endif
()
if
(
NOT TARGET opencv_viz
)
ocv_list_filterout
(
cpp_samples
"/viz/"
)
endif
()
if
(
NOT HAVE_IPP_A
)
ocv_list_filterout
(
cpp_samples
"/ippasync/"
)
endif
()
foreach
(
sample_filename
${
cpp_samples
}
)
if
(
NOT
"
${
sample_filename
}
"
MATCHES
"real_time_pose_estimation/"
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
OPENCV_DEFINE_CPP_EXAMPLE
(
${
sample
}
${
sample_filename
}
)
endif
()
endforeach
()
include
(
"tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt"
)
endif
()
if
(
INSTALL_C_EXAMPLES AND NOT WIN32
)
file
(
GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd
)
install
(
FILES
${
C_SAMPLES
}
DESTINATION
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/cpp
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples
)
endif
()
include
(
"tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt"
OPTIONAL
)
samples/cpp/application_trace.cpp
View file @
a91a11e5
/* OpenCV Application Tracing support demo. */
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/utils/trace.hpp>
using
namespace
cv
;
...
...
samples/cpp/autofocus.cpp
View file @
a91a11e5
...
...
@@ -28,7 +28,9 @@
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
using
namespace
std
;
using
namespace
cv
;
...
...
samples/cpp/detect_blob.cpp
View file @
a91a11e5
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
#include <vector>
#include <map>
#include <iostream>
...
...
samples/cpp/detect_mser.cpp
View file @
a91a11e5
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
#include "opencv2/core/opengl.hpp"
#include "opencv2/cvconfig.h"
#include <vector>
#include <map>
...
...
samples/cpp/matchmethod_orb_akaze_brisk.cpp
View file @
a91a11e5
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/highgui.hpp>
#include <vector>
#include <iostream>
...
...
samples/cpp/train_svmsgd.cpp
View file @
a91a11e5
#include
<opencv2/opencv.hpp>
#include
"opencv2/core.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/ml.hpp"
using
namespace
cv
;
using
namespace
cv
::
ml
;
...
...
samples/cpp/travelsalesman.cpp
View file @
a91a11e5
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/ml.hpp>
using
namespace
cv
;
...
...
samples/cpp/tutorial_code/ImgProc/morph_lines_detection/Morphology_3.cpp
View file @
a91a11e5
...
...
@@ -4,7 +4,10 @@
* @author OpenCV team
*/
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
void
show_wait_destroy
(
const
char
*
winname
,
cv
::
Mat
img
);
...
...
samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp
View file @
a91a11e5
...
...
@@ -4,7 +4,9 @@
* @author OpenCV Team
*/
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
using
namespace
std
;
...
...
samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
View file @
a91a11e5
...
...
@@ -245,11 +245,6 @@ static inline void read(const FileNode& node, Settings& x, const Settings& defau
x
.
read
(
node
);
}
static
inline
void
write
(
FileStorage
&
fs
,
const
String
&
,
const
Settings
&
s
)
{
s
.
write
(
fs
);
}
enum
{
DETECTION
=
0
,
CAPTURING
=
1
,
CALIBRATED
=
2
};
bool
runCalibrationAndSave
(
Settings
&
s
,
Size
imageSize
,
Mat
&
cameraMatrix
,
Mat
&
distCoeffs
,
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt
View file @
a91a11e5
set
(
sample_dir
${
CMAKE_CURRENT_SOURCE_DIR
}
/tutorial_code/calib3d/real_time_pose_estimation/src/
)
set
(
target
cpp-tutorial-
)
set
(
target
example_tutorial_
)
set
(
sample_pnplib
${
sample_dir
}
CsvReader.cpp
...
...
@@ -12,6 +12,8 @@ set(sample_pnplib
${
sample_dir
}
RobustMatcher.cpp
)
ocv_include_modules_recurse
(
${
OPENCV_CPP_SAMPLES_REQUIRED_DEPS
}
)
add_executable
(
${
target
}
pnp_registration
${
sample_dir
}
main_registration.cpp
${
sample_pnplib
}
)
add_executable
(
${
target
}
pnp_detection
${
sample_dir
}
main_detection.cpp
${
sample_pnplib
}
)
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/CsvWriter.h
View file @
a91a11e5
...
...
@@ -3,7 +3,7 @@
#include <iostream>
#include <fstream>
#include <opencv2/core
/core
.hpp>
#include <opencv2/core.hpp>
#include "Utils.h"
using
namespace
std
;
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/ModelRegistration.h
View file @
a91a11e5
...
...
@@ -9,7 +9,7 @@
#define MODELREGISTRATION_H_
#include <iostream>
#include <opencv2/core
/core
.hpp>
#include <opencv2/core.hpp>
class
ModelRegistration
{
...
...
samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp
View file @
a91a11e5
#include <opencv2/features2d.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/highgui.hpp> //for imshow
#include <vector>
#include <iostream>
...
...
samples/cpp/tutorial_code/features2D/Homography/decompose_homography.cpp
View file @
a91a11e5
#include <iostream>
#include <opencv2/opencv_modules.hpp>
#ifdef HAVE_OPENCV_ARUCO
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/aruco.hpp>
using
namespace
std
;
...
...
samples/cpp/tutorial_code/features2D/Homography/homography_from_camera_displacement.cpp
View file @
a91a11e5
#include <iostream>
#include <opencv2/opencv_modules.hpp>
#ifdef HAVE_OPENCV_ARUCO
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/aruco.hpp>
using
namespace
std
;
...
...
samples/cpp/tutorial_code/features2D/Homography/panorama_stitching_rotating_camera.cpp
View file @
a91a11e5
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/stitching.hpp>
using
namespace
std
;
using
namespace
cv
;
...
...
samples/cpp/tutorial_code/features2D/Homography/perspective_correction.cpp
View file @
a91a11e5
#include <iostream>
#include <opencv2/opencv_modules.hpp>
#ifdef HAVE_OPENCV_ARUCO
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/aruco.hpp>
using
namespace
std
;
...
...
@@ -17,32 +20,6 @@ Scalar randomColor( RNG& rng )
return
Scalar
(
icolor
&
255
,
(
icolor
>>
8
)
&
255
,
(
icolor
>>
16
)
&
255
);
}
void
calcChessboardCorners
(
Size
boardSize
,
float
squareSize
,
vector
<
Point3f
>&
corners
,
Pattern
patternType
=
CHESSBOARD
)
{
corners
.
resize
(
0
);
switch
(
patternType
)
{
case
CHESSBOARD
:
case
CIRCLES_GRID
:
for
(
int
i
=
0
;
i
<
boardSize
.
height
;
i
++
)
for
(
int
j
=
0
;
j
<
boardSize
.
width
;
j
++
)
corners
.
push_back
(
Point3f
(
float
(
j
*
squareSize
),
float
(
i
*
squareSize
),
0
));
break
;
case
ASYMMETRIC_CIRCLES_GRID
:
for
(
int
i
=
0
;
i
<
boardSize
.
height
;
i
++
)
for
(
int
j
=
0
;
j
<
boardSize
.
width
;
j
++
)
corners
.
push_back
(
Point3f
(
float
((
2
*
j
+
i
%
2
)
*
squareSize
),
float
(
i
*
squareSize
),
0
));
break
;
default:
CV_Error
(
Error
::
StsBadArg
,
"Unknown pattern type
\n
"
);
}
}
void
perspectiveCorrection
(
const
string
&
img1Path
,
const
string
&
img2Path
,
const
Size
&
patternSize
,
RNG
&
rng
)
{
Mat
img1
=
imread
(
img1Path
);
...
...
samples/cpp/tutorial_code/features2D/Homography/pose_from_homography.cpp
View file @
a91a11e5
#include <iostream>
#include <opencv2/opencv_modules.hpp>
#ifdef HAVE_OPENCV_ARUCO
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/aruco.hpp>
using
namespace
std
;
...
...
samples/cpp/tutorial_code/snippets/core_various.cpp
View file @
a91a11e5
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
using
namespace
std
;
using
namespace
cv
;
...
...
samples/cpp/tutorial_code/snippets/imgcodecs_imwrite.cpp
View file @
a91a11e5
#include <opencv2/
opencv
.hpp>
#include <opencv2/
imgcodecs
.hpp>
using
namespace
cv
;
using
namespace
std
;
...
...
samples/cpp/tutorial_code/snippets/imgproc_HoughLinesPointSet.cpp
View file @
a91a11e5
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
using
namespace
cv
;
using
namespace
std
;
...
...
samples/cpp/tutorial_code/viz/histo3D.cpp
View file @
a91a11e5
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
using
namespace
std
;
...
...
@@ -6,6 +8,8 @@ using namespace cv;
#ifdef HAVE_OPENCV_VIZ
#include <opencv2/viz.hpp>
const
String
keys
=
"{Aide h usage ? help | | print this message }"
"{@arg1 | | Full path to color imag (3 channels)}"
...
...
samples/cpp/tutorial_code/xfeatures2D/LATCH_match.cpp
View file @
a91a11e5
...
...
@@ -4,10 +4,12 @@
#ifdef HAVE_OPENCV_XFEATURES2D
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/opencv.hpp>
#include <vector>
// If you find this code useful, please add a reference to the following paper in your work:
...
...
samples/cpp/videocapture_basic.cpp
View file @
a91a11e5
...
...
@@ -5,7 +5,9 @@
@date Aug 24, 2016
*/
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <stdio.h>
...
...
@@ -49,4 +51,4 @@ int main(int, char**)
}
// the camera will be deinitialized automatically in VideoCapture destructor
return
0
;
}
\ No newline at end of file
}
samples/cpp/videowriter_basic.cpp
View file @
a91a11e5
...
...
@@ -5,7 +5,9 @@
@date Aug 24, 2016
*/
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <stdio.h>
...
...
@@ -62,4 +64,4 @@ int main(int, char**)
}
// the videofile will be closed and released automatically in VideoWriter destructor
return
0
;
}
\ No newline at end of file
}
samples/directx/CMakeLists.txt
View file @
a91a11e5
SET
(
OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui
)
ocv_install_example_src
(
directx *.cpp *.hpp CMakeLists.txt
)
set
(
OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_imgcodecs
opencv_videoio
opencv_highgui
)
ocv_check_dependencies
(
${
OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
set
(
project
"directx"
)
string
(
TOUPPER
"
${
project
}
"
project_upper
)
project
(
"
${
project
}
_samples"
)
ocv_include_modules_recurse
(
${
OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS
}
)
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_DIRECTX_EXAMPLE name srcs
)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
PROJECT_LABEL
"(EXAMPLE_
${
project_upper
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//
${
project
}
"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/
${
project
}
"
COMPONENT samples
)
endif
()
ENDMACRO
()
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
file
(
GLOB sample_srcs RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
${
sample
}
.*
)
OPENCV_DEFINE_DIRECTX_EXAMPLE
(
${
sample
}
${
sample_srcs
}
)
endforeach
()
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
project
(
"directx_samples"
)
ocv_include_modules_recurse
(
${
tgt
}
${
OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS
}
)
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
directx
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS
}
)
endforeach
()
samples/dnn/CMakeLists.txt
View file @
a91a11e5
SET
(
OPENCV_DNN_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_dnn
opencv_imgcodecs opencv_videoio opencv_highgui
${
OpenCV_LIB_COMPONENTS
}
)
ocv_install_example_src
(
dnn *.cpp *.hpp CMakeLists.txt
)
set
(
OPENCV_DNN_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_dnn
opencv_imgcodecs
opencv_videoio
opencv_highgui
)
ocv_check_dependencies
(
${
OPENCV_DNN_SAMPLES_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
project
(
dnn_samples
)
# Model branch name: dnn_samples_face_detector_20170830
set
(
DNN_FACE_DETECTOR_MODEL_COMMIT
"b2bfc75f6aea5b1f834ff0f0b865a7c18ff1459f"
)
set
(
DNN_FACE_DETECTOR_MODEL_HASH
"afbb6037fd180e8d2acb3b58ca737b9e"
)
set
(
DNN_FACE_DETECTOR_MODEL_NAME
"res10_300x300_ssd_iter_140000.caffemodel"
)
set
(
DNN_FACE_DETECTOR_MODEL_DOWNLOAD_DIR
"
${
CMAKE_CURRENT_LIST_DIR
}
/face_detector"
)
if
(
COMMAND ocv_download
)
ocv_download
(
FILENAME
${
DNN_FACE_DETECTOR_MODEL_NAME
}
HASH
${
DNN_FACE_DETECTOR_MODEL_HASH
}
URL
"$ENV{OPENCV_DNN_MODELS_URL}"
"
${
OPENCV_DNN_MODELS_URL
}
"
"https://raw.githubusercontent.com/opencv/opencv_3rdparty/
${
DNN_FACE_DETECTOR_MODEL_COMMIT
}
/"
DESTINATION_DIR
${
DNN_FACE_DETECTOR_MODEL_DOWNLOAD_DIR
}
ID DNN_FACE_DETECTOR
RELATIVE_URL
STATUS res
)
endif
()
ocv_include_directories
(
"
${
OpenCV_SOURCE_DIR
}
/include"
)
ocv_include_modules_recurse
(
${
OPENCV_DNN_SAMPLES_REQUIRED_DEPS
}
)
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_DNN_EXAMPLE name srcs
)
set
(
sample_kind example_dnn
)
set
(
sample_subfolder
"dnn"
)
set
(
the_target
"
${
sample_kind
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_DNN_SAMPLES_REQUIRED_DEPS
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
sample_kind
}
-
${
name
}
"
PROJECT_LABEL
"(
${
sample_KIND
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples/
${
sample_subfolder
}
"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/
${
sample_subfolder
}
"
COMPONENT samples
)
endif
()
ENDMACRO
()
file
(
GLOB_RECURSE dnn_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
dnn_samples
}
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
OPENCV_DEFINE_DNN_EXAMPLE
(
${
sample
}
${
sample_filename
}
)
endforeach
()
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
if
(
INSTALL_C_EXAMPLES AND NOT WIN32
)
file
(
GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd
)
install
(
FILES
${
C_SAMPLES
}
DESTINATION
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/dnn
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples
)
# Model branch name: dnn_samples_face_detector_20170830
set
(
DNN_FACE_DETECTOR_MODEL_COMMIT
"b2bfc75f6aea5b1f834ff0f0b865a7c18ff1459f"
)
set
(
DNN_FACE_DETECTOR_MODEL_HASH
"afbb6037fd180e8d2acb3b58ca737b9e"
)
set
(
DNN_FACE_DETECTOR_MODEL_NAME
"res10_300x300_ssd_iter_140000.caffemodel"
)
set
(
DNN_FACE_DETECTOR_MODEL_DOWNLOAD_DIR
"
${
CMAKE_CURRENT_LIST_DIR
}
/face_detector"
)
if
(
COMMAND ocv_download
)
ocv_download
(
FILENAME
${
DNN_FACE_DETECTOR_MODEL_NAME
}
HASH
${
DNN_FACE_DETECTOR_MODEL_HASH
}
URL
"$ENV{OPENCV_DNN_MODELS_URL}"
"
${
OPENCV_DNN_MODELS_URL
}
"
"https://raw.githubusercontent.com/opencv/opencv_3rdparty/
${
DNN_FACE_DETECTOR_MODEL_COMMIT
}
/"
DESTINATION_DIR
${
DNN_FACE_DETECTOR_MODEL_DOWNLOAD_DIR
}
ID DNN_FACE_DETECTOR
RELATIVE_URL
STATUS res
)
endif
()
project
(
dnn_samples
)
ocv_include_modules_recurse
(
${
OPENCV_DNN_SAMPLES_REQUIRED_DEPS
}
)
file
(
GLOB_RECURSE dnn_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
dnn_samples
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
dnn
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_DNN_SAMPLES_REQUIRED_DEPS
}
)
endforeach
()
samples/gpu/CMakeLists.txt
View file @
a91a11e5
SET
(
OPENCV_CUDA_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui
opencv_ml opencv_video opencv_objdetect opencv_features2d
opencv_calib3d opencv_superres
opencv_cudaarithm opencv_cudafilters opencv_cudawarping opencv_cudaimgproc
opencv_cudafeatures2d opencv_cudaoptflow opencv_cudabgsegm
opencv_cudastereo opencv_cudalegacy opencv_cudaobjdetect
)
ocv_install_example_src
(
gpu *.cpp *.hpp CMakeLists.txt
)
set
(
OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_flann
opencv_imgproc
opencv_imgcodecs
opencv_videoio
opencv_highgui
opencv_ml
opencv_video
opencv_objdetect
opencv_features2d
opencv_calib3d
opencv_superres
opencv_cudaarithm
opencv_cudafilters
opencv_cudawarping
opencv_cudaimgproc
opencv_cudafeatures2d
opencv_cudaoptflow
opencv_cudabgsegm
opencv_cudastereo
opencv_cudalegacy
opencv_cudaobjdetect
)
ocv_check_dependencies
(
${
OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
set
(
project
"gpu"
)
string
(
TOUPPER
"
${
project
}
"
project_upper
)
project
(
"
${
project
}
_samples"
)
ocv_include_modules_recurse
(
${
OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
}
)
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
project
(
gpu_samples
)
ocv_include_modules_recurse
(
${
OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
}
)
if
(
HAVE_opencv_xfeatures2d
)
ocv_include_modules_recurse
(
opencv_xfeatures2d
)
endif
()
if
(
HAVE_opencv_cudacodec
)
ocv_include_modules_recurse
(
opencv_cudacodec
)
endif
()
if
(
HAVE_CUDA
)
ocv_include_directories
(
${
CUDA_INCLUDE_DIRS
}
)
endif
()
if
(
CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-unused-function"
)
endif
()
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
if
(
NOT HAVE_OPENGL
)
ocv_list_filterout
(
all_samples
"opengl"
)
endif
()
foreach
(
sample_filename
${
all_samples
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
gpu
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
}
)
if
(
HAVE_opencv_xfeatures2d
)
ocv_
include_modules_recurse
(
opencv_xfeatures2d
)
ocv_
target_link_libraries
(
${
tgt
}
opencv_xfeatures2d
)
endif
()
if
(
HAVE_opencv_cudacodec
)
ocv_include_modules_recurse
(
opencv_cudacodec
)
endif
()
if
(
HAVE_CUDA
)
ocv_include_directories
(
${
CUDA_INCLUDE_DIRS
}
)
ocv_target_link_libraries
(
${
tgt
}
opencv_cudacodec
)
endif
()
if
(
CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-unused-function"
)
endif
()
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_CUDA_EXAMPLE name srcs
)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_CUDA_SAMPLES_REQUIRED_DEPS
}
)
if
(
HAVE_CUDA AND NOT ANDROID
)
ocv_target_link_libraries
(
${
the_target
}
${
CUDA_CUDA_LIBRARY
}
)
endif
()
if
(
HAVE_opencv_xfeatures2d
)
ocv_target_link_libraries
(
${
the_target
}
opencv_xfeatures2d
)
endif
()
if
(
HAVE_opencv_cudacodec
)
ocv_target_link_libraries
(
${
the_target
}
opencv_cudacodec
)
endif
()
if
(
HAVE_opencv_ocl
)
ocv_target_link_libraries
(
${
the_target
}
opencv_ocl
)
endif
()
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
PROJECT_LABEL
"(EXAMPLE_
${
project_upper
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//
${
project
}
"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/
${
project
}
"
COMPONENT samples
)
endif
()
ENDMACRO
()
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
if
(
NOT HAVE_OPENGL
)
list
(
REMOVE_ITEM all_samples
"opengl.cpp"
)
endif
()
foreach
(
sample_filename
${
all_samples
}
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
file
(
GLOB sample_srcs RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
${
sample
}
.*
)
OPENCV_DEFINE_CUDA_EXAMPLE
(
${
sample
}
${
sample_srcs
}
)
endforeach
()
include
(
"performance/CMakeLists.txt"
)
endif
()
if
(
INSTALL_C_EXAMPLES AND NOT WIN32
)
file
(
GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd
)
if
(
NOT HAVE_OPENGL
)
list
(
REMOVE_ITEM install_list
"opengl.cpp"
)
endif
()
install
(
FILES
${
install_list
}
DESTINATION
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/gpu
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples
)
endif
()
endforeach
()
include
(
"performance/CMakeLists.txt"
OPTIONAL
)
samples/gpu/performance/CMakeLists.txt
View file @
a91a11e5
...
...
@@ -34,10 +34,4 @@ if(WIN32)
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/gpu"
COMPONENT samples
)
endif
()
if
(
INSTALL_C_EXAMPLES AND NOT WIN32
)
file
(
GLOB CUDA_FILES performance/*.cpp performance/*.h
)
install
(
FILES
${
CUDA_FILES
}
DESTINATION
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/gpu/performance
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
COMPONENT samples
)
endif
()
ocv_install_example_src
(
"gpu/performance"
performance/*.cpp performance/*.h
)
samples/opencl/CMakeLists.txt
View file @
a91a11e5
# cmake 3.1 needed for find_package(OpenCL
)
ocv_install_example_src
(
opencl *.cpp *.hpp CMakeLists.txt
)
# cmake 3.1 needed for find_package(OpenCL)
if
(
CMAKE_VERSION VERSION_LESS
"3.1"
)
message
(
STATUS
"OpenCL samples require CMakes 3.1+"
)
return
()
endif
()
set
(
OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_video
opencv_imgcodecs
opencv_videoio
opencv_highgui
)
set
(
OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_video
opencv_imgcodecs
opencv_videoio
opencv_highgui
)
ocv_check_dependencies
(
${
OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
find_package
(
OpenCL 1.2 QUIET
)
if
(
NOT OpenCL_FOUND
)
message
(
STATUS
"OpenCL samples are skipped: OpenCL SDK is required"
)
return
()
endif
()
set
(
project
"opencl"
)
string
(
TOUPPER
"
${
project
}
"
project_upper
)
project
(
"
${
project
}
_samples"
)
ocv_include_modules_recurse
(
${
OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS
}
)
include_directories
(
${
OpenCL_INCLUDE_DIR
}
)
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_OPENCL_EXAMPLE name srcs
)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS
}
${
OpenCL_LIBRARY
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
PROJECT_LABEL
"(EXAMPLE_
${
project_upper
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//
${
project
}
"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/
${
project
}
"
COMPONENT main
)
endif
()
ENDMACRO
()
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
foreach
(
sample_filename
${
all_samples
}
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
file
(
GLOB sample_srcs RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
${
sample
}
.*
)
OPENCV_DEFINE_OPENCL_EXAMPLE
(
${
sample
}
${
sample_srcs
}
)
endforeach
()
find_package
(
OpenCL 1.2 QUIET
)
if
(
NOT OpenCL_FOUND
)
message
(
STATUS
"OpenCL samples are skipped: OpenCL SDK is required"
)
return
()
endif
()
project
(
opencl_samples
)
ocv_include_modules_recurse
(
${
OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS
}
)
ocv_include_directories
(
${
OpenCL_INCLUDE_DIR
}
)
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
opencl
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS
}
${
OpenCL_LIBRARY
}
)
endforeach
()
samples/opencl/opencl-opencv-interop.cpp
View file @
a91a11e5
...
...
@@ -16,7 +16,7 @@
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS // eliminate build warning
#if __APPLE__
#if
def
__APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
...
...
samples/opengl/CMakeLists.txt
View file @
a91a11e5
...
...
@@ -12,50 +12,23 @@ if(UNIX)
set
(
SAMPLE_LINKER_DEPS
"
${
X11_LIBRARIES
}
"
)
endif
()
SET
(
OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui
)
SET
(
OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_imgcodecs
opencv_videoio
opencv_highgui
)
ocv_check_dependencies
(
${
OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
set
(
project
"opengl"
)
string
(
TOUPPER
"
${
project
}
"
project_upper
)
project
(
"
${
project
}
_samples"
)
project
(
opengl_samples
)
ocv_include_modules_recurse
(
${
OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS
}
)
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_OPENGL_EXAMPLE name srcs
)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS
}
${
SAMPLE_LINKER_DEPS
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
PROJECT_LABEL
"(EXAMPLE_
${
project_upper
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//
${
project
}
"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/
${
project
}
"
COMPONENT samples
)
endif
()
ENDMACRO
()
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
file
(
GLOB sample_srcs RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
${
sample
}
.*
)
OPENCV_DEFINE_OPENGL_EXAMPLE
(
${
sample
}
${
sample_srcs
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
opengl
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS
}
${
SAMPLE_LINKER_DEPS
}
)
endforeach
()
endif
()
ocv_install_example_src
(
opengl *.cpp *.hpp CMakeLists.txt
)
samples/openvx/CMakeLists.txt
View file @
a91a11e5
cmake_minimum_required
(
VERSION 2.8.9
)
ocv_install_example_src
(
cpp *.cpp *.hpp CMakeLists.txt
)
set
(
OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui
)
cmake_minimum_required
(
VERSION 2.8.9
)
set
(
OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_imgcodecs
opencv_videoio
opencv_highgui
)
ocv_check_dependencies
(
${
OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
set
(
group
"openvx"
)
set
(
name_wrapped
"interop"
)
set
(
name_orig
"interop_orig"
)
set
(
name_video
"interop_video"
)
project
(
"
${
group
}
_sample"
)
ocv_include_modules_recurse
(
${
OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS
}
)
add_definitions
(
-DIVX_USE_OPENCV
)
add_definitions
(
-DIVX_HIDE_INFO_WARNINGS
)
file
(
GLOB srcs_wrapped wrappers.cpp *.hpp
)
file
(
GLOB srcs_orig no_wrappers.cpp *.hpp
)
file
(
GLOB srcs_video wrappers_video.cpp *.hpp
)
MACRO
(
OPENVX_DEFINE_SAMPLE name srcs
)
set
(
target
"example_
${
group
}
_
${
name
}
"
)
add_executable
(
${
target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS
}
${
OPENVX_LIBRARIES
}
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
target
}
PROPERTIES FOLDER
"samples//
${
group
}
"
)
endif
()
ENDMACRO
()
OPENVX_DEFINE_SAMPLE
(
${
name_wrapped
}
${
srcs_wrapped
}
)
OPENVX_DEFINE_SAMPLE
(
${
name_orig
}
${
srcs_orig
}
)
OPENVX_DEFINE_SAMPLE
(
${
name_video
}
${
srcs_video
}
)
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
project
(
openvx_samples
)
ocv_include_modules_recurse
(
${
OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS
}
)
add_definitions
(
-DIVX_USE_OPENCV
)
add_definitions
(
-DIVX_HIDE_INFO_WARNINGS
)
file
(
GLOB_RECURSE cpp_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
cpp_samples
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
openvx
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS
}
)
endforeach
()
samples/tapi/CMakeLists.txt
View file @
a91a11e5
SET
(
OPENCV_TAPI_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_video opencv_imgcodecs opencv_videoio opencv_highgui opencv_objdetect opencv_features2d opencv_calib3d opencv_flann
)
ocv_install_example_src
(
tapi *.cpp *.hpp CMakeLists.txt
)
set
(
OPENCV_TAPI_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_video
opencv_imgcodecs
opencv_videoio
opencv_highgui
opencv_objdetect
opencv_features2d
opencv_calib3d
opencv_flann
)
ocv_check_dependencies
(
${
OPENCV_TAPI_SAMPLES_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
set
(
project
"tapi"
)
string
(
TOUPPER
"
${
project
}
"
project_upper
)
project
(
"
${
project
}
_samples"
)
ocv_include_modules_recurse
(
${
OPENCV_TAPI_SAMPLES_REQUIRED_DEPS
}
)
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_TAPI_EXAMPLE name srcs
)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_TAPI_SAMPLES_REQUIRED_DEPS
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
PROJECT_LABEL
"(EXAMPLE_
${
project_upper
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//
${
project
}
"
)
endif
()
if
(
WIN32
)
if
(
MSVC AND NOT BUILD_SHARED_LIBS
)
set_target_properties
(
${
the_target
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG"
)
endif
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
"
${
OPENCV_SAMPLES_BIN_INSTALL_PATH
}
/
${
project
}
"
COMPONENT samples
)
endif
()
ENDMACRO
()
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
file
(
GLOB sample_srcs RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
${
sample
}
.*
)
OPENCV_DEFINE_TAPI_EXAMPLE
(
${
sample
}
${
sample_srcs
}
)
endforeach
()
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
if
(
INSTALL_C_EXAMPLES AND NOT WIN32
)
file
(
GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd
)
install
(
FILES
${
install_list
}
DESTINATION
${
OPENCV_SAMPLES_SRC_INSTALL_PATH
}
/tapi
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples
)
endif
()
project
(
tapi_samples
)
ocv_include_modules_recurse
(
${
OPENCV_TAPI_SAMPLES_REQUIRED_DEPS
}
)
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
tapi
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_TAPI_SAMPLES_REQUIRED_DEPS
}
)
endforeach
()
samples/va_intel/CMakeLists.txt
View file @
a91a11e5
SET
(
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_imgcodecs opencv_videoio opencv_highgui
)
ocv_install_example_src
(
opencl *.cpp *.inc CMakeLists.txt
)
set
(
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
opencv_core
opencv_imgproc
opencv_imgcodecs
opencv_videoio
opencv_highgui
)
ocv_check_dependencies
(
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
)
if
(
BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND
)
set
(
project
"va_intel"
)
string
(
TOUPPER
"
${
project
}
"
project_upper
)
project
(
"
${
project
}
_samples"
)
ocv_include_modules_recurse
(
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
)
# ---------------------------------------------
# Define executable targets
# ---------------------------------------------
MACRO
(
OPENCV_DEFINE_VA_INTEL_EXAMPLE name srcs
)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
${
VA_LIBRARIES
}
${
VA_INTEL_LIBRARIES
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
PROJECT_LABEL
"(EXAMPLE_
${
project_upper
}
)
${
name
}
"
)
if
(
ENABLE_SOLUTION_FOLDERS
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"samples//
${
project
}
"
)
endif
()
ENDMACRO
()
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
get_filename_component
(
sample
${
sample_filename
}
NAME_WE
)
file
(
GLOB sample_srcs RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
${
sample
}
.*
)
OPENCV_DEFINE_VA_INTEL_EXAMPLE
(
${
sample
}
${
sample_srcs
}
)
endforeach
()
if
(
NOT BUILD_EXAMPLES OR NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
project
(
va_intel_samples
)
ocv_include_modules_recurse
(
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
)
file
(
GLOB all_samples RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
foreach
(
sample_filename
${
all_samples
}
)
ocv_define_sample
(
tgt
${
sample_filename
}
va_intel
)
ocv_target_link_libraries
(
${
tgt
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
)
endforeach
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment