mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Python support
This commit is contained in:
parent
457123027e
commit
37c74e38f4
@ -24,22 +24,6 @@
|
||||
# OPENCV_MODULE_${the_module}_WRAPPERS - list of wrappers supporting this module
|
||||
# HAVE_${the_module} - for fast check of module availability
|
||||
|
||||
# Module layout:
|
||||
# <module>
|
||||
# ├── doc - docs
|
||||
# ├── include
|
||||
# │ └── opencv2
|
||||
# │ └── <module> - sub headers
|
||||
# ├── misc
|
||||
# │ ├── java - additional files for java wrapper
|
||||
# │ └── python - additional files for python wrapper
|
||||
# ├── perf - perfomance tests
|
||||
# ├── samples - sample code
|
||||
# ├── src - sources
|
||||
# ├── test - accuracy tests
|
||||
# └── tutorials - tutorials
|
||||
|
||||
|
||||
# To control the setup of the module you could also set:
|
||||
# the_description - text to be used as current module description
|
||||
# OPENCV_MODULE_TYPE - STATIC|SHARED - set to force override global settings for current module
|
||||
@ -77,6 +61,7 @@ foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MOD
|
||||
unset(OPENCV_MODULE_${mod}_PRIVATE_REQ_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_PRIVATE_OPT_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_LINK_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${mod}_WRAPPERS CACHE)
|
||||
endforeach()
|
||||
|
||||
# clean modules info which needs to be recalculated
|
||||
@ -112,6 +97,15 @@ macro(ocv_add_dependencies full_modname)
|
||||
endforeach()
|
||||
unset(__depsvar)
|
||||
|
||||
# hack for python
|
||||
set(__python_idx)
|
||||
list(FIND OPENCV_MODULE_${full_modname}_WRAPPERS "python" __python_idx)
|
||||
if (NOT __python_idx EQUAL -1)
|
||||
list(REMOVE_ITEM OPENCV_MODULE_${full_modname}_WRAPPERS "python")
|
||||
list(APPEND OPENCV_MODULE_${full_modname}_WRAPPERS "python2" "python3")
|
||||
endif()
|
||||
unset(__python_idx)
|
||||
|
||||
ocv_list_unique(OPENCV_MODULE_${full_modname}_REQ_DEPS)
|
||||
ocv_list_unique(OPENCV_MODULE_${full_modname}_OPT_DEPS)
|
||||
ocv_list_unique(OPENCV_MODULE_${full_modname}_PRIVATE_REQ_DEPS)
|
||||
|
@ -1,2 +1,2 @@
|
||||
set(the_description "Camera Calibration and 3D Reconstruction")
|
||||
ocv_define_module(calib3d opencv_imgproc opencv_features2d WRAP java)
|
||||
ocv_define_module(calib3d opencv_imgproc opencv_features2d WRAP java python)
|
||||
|
@ -1,7 +1,7 @@
|
||||
set(the_description "The Core Functionality")
|
||||
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}"
|
||||
OPTIONAL opencv_cudev
|
||||
WRAP java)
|
||||
WRAP java python)
|
||||
|
||||
if(HAVE_WINRT_CX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
|
||||
|
@ -1,2 +1,2 @@
|
||||
set(the_description "2D Features Framework")
|
||||
ocv_define_module(features2d opencv_imgproc opencv_ml opencv_flann OPTIONAL opencv_highgui WRAP java)
|
||||
ocv_define_module(features2d opencv_imgproc opencv_ml opencv_flann OPTIONAL opencv_highgui WRAP java python)
|
||||
|
@ -1,2 +1,2 @@
|
||||
set(the_description "Clustering and Search in Multi-Dimensional Spaces")
|
||||
ocv_define_module(flann opencv_core)
|
||||
ocv_define_module(flann opencv_core WRAP python)
|
||||
|
@ -1,5 +1,5 @@
|
||||
set(the_description "High-level GUI and Media I/O")
|
||||
ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL opencv_androidcamera)
|
||||
ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL opencv_androidcamera WRAP python)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for highgui. See root CMakeLists.txt
|
||||
|
@ -1,5 +1,5 @@
|
||||
set(the_description "Image codecs")
|
||||
ocv_add_module(imgcodecs opencv_imgproc WRAP java)
|
||||
ocv_add_module(imgcodecs opencv_imgproc WRAP java python)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for imgcodecs. See root CMakeLists.txt
|
||||
|
@ -1,2 +1,2 @@
|
||||
set(the_description "Image Processing")
|
||||
ocv_define_module(imgproc opencv_core WRAP java)
|
||||
ocv_define_module(imgproc opencv_core WRAP java python)
|
||||
|
@ -20,13 +20,13 @@ set(JAVA_INSTALL_ROOT "sdk/java")
|
||||
set(JNI_INSTALL_ROOT "sdk/native")
|
||||
|
||||
# get list of modules to wrap
|
||||
message(STATUS "Wrapped in java:")
|
||||
# message(STATUS "Wrapped in java:")
|
||||
set(OPENCV_JAVA_MODULES)
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if (";${OPENCV_MODULE_${m}_WRAPPERS};" MATCHES ";java;" AND HAVE_${m})
|
||||
string(REPLACE "opencv_" "" m ${m})
|
||||
list(APPEND OPENCV_JAVA_MODULES ${m})
|
||||
message(STATUS "\topencv_${m}")
|
||||
# message(STATUS "\topencv_${m}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
set(the_description "Object Detection")
|
||||
ocv_define_module(objdetect opencv_core opencv_imgproc opencv_ml OPTIONAL opencv_highgui WRAP java)
|
||||
ocv_define_module(objdetect opencv_core opencv_imgproc opencv_ml OPTIONAL opencv_highgui WRAP java python)
|
||||
|
@ -4,4 +4,4 @@ if(HAVE_CUDA)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
|
||||
endif()
|
||||
|
||||
ocv_define_module(photo opencv_imgproc OPTIONAL opencv_cudaarithm opencv_cudaimgproc WRAP java)
|
||||
ocv_define_module(photo opencv_imgproc OPTIONAL opencv_cudaarithm opencv_cudaimgproc WRAP java python)
|
||||
|
@ -1,28 +1,7 @@
|
||||
# This file is included from a subdirectory
|
||||
set(PYTHON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../")
|
||||
|
||||
set(candidate_deps "")
|
||||
foreach(mp ${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
|
||||
file(GLOB names "${mp}/*")
|
||||
foreach(m IN LISTS names)
|
||||
if(IS_DIRECTORY ${m})
|
||||
get_filename_component(m ${m} NAME)
|
||||
list(APPEND candidate_deps "opencv_${m}")
|
||||
endif()
|
||||
endforeach(m)
|
||||
endforeach(mp)
|
||||
|
||||
# module blacklist
|
||||
ocv_list_filterout(candidate_deps "^opencv_cud(a|ev)")
|
||||
ocv_list_filterout(candidate_deps "^opencv_matlab$")
|
||||
ocv_list_filterout(candidate_deps "^opencv_ts$")
|
||||
ocv_list_filterout(candidate_deps "^opencv_adas$")
|
||||
ocv_list_filterout(candidate_deps "^opencv_tracking$")
|
||||
ocv_list_filterout(candidate_deps "^opencv_bioinspired$")
|
||||
ocv_list_filterout(candidate_deps "^opencv_java$")
|
||||
ocv_list_filterout(candidate_deps "^opencv_contrib_world$")
|
||||
|
||||
ocv_add_module(${MODULE_NAME} BINDINGS OPTIONAL ${candidate_deps})
|
||||
ocv_add_module(${MODULE_NAME} BINDINGS)
|
||||
|
||||
ocv_module_include_directories(
|
||||
"${PYTHON_INCLUDE_PATH}"
|
||||
@ -30,16 +9,25 @@ ocv_module_include_directories(
|
||||
"${PYTHON_SOURCE_DIR}/src2"
|
||||
)
|
||||
|
||||
# get list of modules to wrap
|
||||
# message(STATUS "Wrapped in ${MODULE_NAME}:")
|
||||
set(OPENCV_PYTHON_MODULES)
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if (";${OPENCV_MODULE_${m}_WRAPPERS};" MATCHES ";${MODULE_NAME};" AND HAVE_${m})
|
||||
list(APPEND OPENCV_PYTHON_MODULES ${m})
|
||||
# message(STATUS "\t${m}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(opencv_hdrs "")
|
||||
foreach(m IN LISTS OPENCV_MODULE_opencv_${MODULE_NAME}_DEPS)
|
||||
list(APPEND opencv_hdrs ${OPENCV_MODULE_${m}_HEADERS})
|
||||
foreach(m ${OPENCV_PYTHON_MODULES})
|
||||
list(APPEND opencv_hdrs ${OPENCV_MODULE_${m}_HEADERS})
|
||||
endforeach(m)
|
||||
|
||||
# header blacklist
|
||||
ocv_list_filterout(opencv_hdrs ".h$")
|
||||
ocv_list_filterout(opencv_hdrs "cuda")
|
||||
ocv_list_filterout(opencv_hdrs "cudev")
|
||||
ocv_list_filterout(opencv_hdrs "opencv2/objdetect/detection_based_tracker.hpp")
|
||||
|
||||
set(cv2_generated_hdrs
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
|
||||
|
@ -1,2 +1,2 @@
|
||||
set(the_description "Shape descriptors and matchers.")
|
||||
ocv_define_module(shape opencv_core opencv_imgproc opencv_video)
|
||||
ocv_define_module(shape opencv_core opencv_imgproc opencv_video WRAP python)
|
||||
|
@ -5,4 +5,5 @@ if(HAVE_CUDA)
|
||||
endif()
|
||||
|
||||
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect
|
||||
OPTIONAL opencv_cudaarithm opencv_cudafilters opencv_cudafeatures2d opencv_cudalegacy opencv_xfeatures2d)
|
||||
OPTIONAL opencv_cudaarithm opencv_cudafilters opencv_cudafeatures2d opencv_cudalegacy opencv_xfeatures2d
|
||||
WRAP python)
|
||||
|
@ -5,4 +5,5 @@ endif()
|
||||
set(the_description "Super Resolution")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 -Wundef -Wshadow)
|
||||
ocv_define_module(superres opencv_imgproc opencv_video
|
||||
OPTIONAL opencv_videoio opencv_cudaarithm opencv_cudafilters opencv_cudawarping opencv_cudaimgproc opencv_cudaoptflow opencv_cudacodec)
|
||||
OPTIONAL opencv_videoio opencv_cudaarithm opencv_cudafilters opencv_cudawarping opencv_cudaimgproc opencv_cudaoptflow opencv_cudacodec
|
||||
WRAP python)
|
||||
|
@ -1,2 +1,2 @@
|
||||
set(the_description "Video Analysis")
|
||||
ocv_define_module(video opencv_imgproc WRAP java)
|
||||
ocv_define_module(video opencv_imgproc WRAP java python)
|
||||
|
@ -1,5 +1,5 @@
|
||||
set(the_description "Media I/O")
|
||||
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera WRAP java)
|
||||
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera WRAP java python)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for videoio. See root CMakeLists.txt
|
||||
|
@ -5,4 +5,4 @@ if(HAVE_CUDA)
|
||||
endif()
|
||||
|
||||
ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d
|
||||
OPTIONAL opencv_cudawarping opencv_cudaoptflow opencv_videoio)
|
||||
OPTIONAL opencv_cudawarping opencv_cudaoptflow opencv_videoio WRAP python)
|
||||
|
@ -4,7 +4,7 @@ endif()
|
||||
|
||||
include(${VTK_USE_FILE})
|
||||
set(the_description "Viz")
|
||||
ocv_define_module(viz opencv_core ${VTK_LIBRARIES})
|
||||
ocv_define_module(viz opencv_core ${VTK_LIBRARIES} WRAP python)
|
||||
|
||||
if(APPLE AND BUILD_opencv_viz)
|
||||
ocv_target_link_libraries(opencv_viz "-framework Cocoa")
|
||||
|
Loading…
Reference in New Issue
Block a user