mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 05:29:54 +08:00
moved Python bindings source code into src subdirectory; preparing to add python/doc and python/test subdirectories
This commit is contained in:
parent
26d348a5b7
commit
335370a7c0
@ -5,7 +5,7 @@ project(opencv_python)
|
||||
|
||||
include_directories(${PYTHON_INCLUDE_PATH})
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
"${CMAKE_SOURCE_DIR}/modules/core/include"
|
||||
"${CMAKE_SOURCE_DIR}/modules/imgproc/include"
|
||||
"${CMAKE_SOURCE_DIR}/modules/video/include"
|
||||
@ -30,7 +30,7 @@ set(opencv_hdrs "${CMAKE_SOURCE_DIR}/modules/core/include/opencv2/core/core.hpp"
|
||||
"${CMAKE_SOURCE_DIR}/modules/features2d/include/opencv2/features2d/features2d.hpp"
|
||||
"${CMAKE_SOURCE_DIR}/modules/calib3d/include/opencv2/calib3d/calib3d.hpp"
|
||||
"${CMAKE_SOURCE_DIR}/modules/objdetect/include/opencv2/objdetect/objdetect.hpp"
|
||||
"${CMAKE_SOURCE_DIR}/modules/python/opencv_extra_api.hpp")
|
||||
"${CMAKE_SOURCE_DIR}/modules/python/src/opencv_extra_api.hpp")
|
||||
|
||||
set(generated_hdrs
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_funcs.h"
|
||||
@ -43,27 +43,27 @@ if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
|
||||
endif()
|
||||
|
||||
file(GLOB lib_srcs "*.cpp")
|
||||
file(GLOB lib_hdrs "*.h")
|
||||
file(GLOB lib_srcs "src/*.cpp")
|
||||
file(GLOB lib_hdrs "src/*.h")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated0.i
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen.py ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/api
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/defs
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen.py
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/src/gen.py" "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/api
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/defs
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/gen.py
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${generated_hdrs}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen2.py ${CMAKE_CURRENT_BINARY_DIR} ${opencv_hdrs}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen2.py
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/hdr_parser.py
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/src/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} ${opencv_hdrs}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/gen2.py
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/hdr_parser.py
|
||||
DEPENDS ${opencv_hdrs}
|
||||
)
|
||||
|
||||
set(the_target "opencv_python")
|
||||
add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${CMAKE_CURRENT_BINARY_DIR}/generated0.i opencv2x.h opencv_extra_api.hpp ${generated_hdrs})
|
||||
add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${CMAKE_CURRENT_BINARY_DIR}/generated0.i src/opencv2x.h src/opencv_extra_api.hpp ${generated_hdrs})
|
||||
target_link_libraries(${the_target} ${PYTHON_LIBRARIES} opencv_core opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_highgui opencv_calib3d opencv_objdetect opencv_legacy opencv_contrib)
|
||||
|
||||
set_target_properties(${the_target} PROPERTIES PREFIX "")
|
||||
|
BIN
modules/python/hdr_parser.pyc
Executable file
BIN
modules/python/hdr_parser.pyc
Executable file
Binary file not shown.
@ -3946,7 +3946,7 @@ static double cppKMeans(const CvArr* _samples, int cluster_count, CvArr* _labels
|
||||
(labels.cols == 1 || labels.rows == 1) &&
|
||||
labels.cols + labels.rows - 1 == data.rows );
|
||||
return cv::kmeans(data, cluster_count, labels, termcrit, attempts,
|
||||
flags, _centers ? ¢ers : 0 );
|
||||
flags, _centers ? cv::OutputArray(centers) : cv::OutputArray() );
|
||||
}
|
||||
|
||||
#define cvKMeans2(samples, nclusters, labels, termcrit, attempts, flags, centers) \
|
||||
@ -4038,7 +4038,7 @@ void initcv()
|
||||
m = Py_InitModule(MODULESTR"", methods);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
PyDict_SetItemString(d, "__version__", PyString_FromString("$Rev$"));
|
||||
PyDict_SetItemString(d, "__version__", PyString_FromString("$Rev: 4557 $"));
|
||||
|
||||
opencv_error = PyErr_NewException((char*)MODULESTR".error", NULL, NULL);
|
||||
PyDict_SetItemString(d, "error", opencv_error);
|
@ -2,15 +2,15 @@ import os, sys, re
|
||||
|
||||
# the list only for debugging. The real list, used in the real OpenCV build, is specified in CMakeLists.txt
|
||||
opencv_hdr_list = [
|
||||
"../core/include/opencv2/core/core.hpp",
|
||||
"../ml/include/opencv2/ml/ml.hpp",
|
||||
"../imgproc/include/opencv2/imgproc/imgproc.hpp",
|
||||
"../calib3d/include/opencv2/calib3d/calib3d.hpp",
|
||||
"../features2d/include/opencv2/features2d/features2d.hpp",
|
||||
"../video/include/opencv2/video/tracking.hpp",
|
||||
"../video/include/opencv2/video/background_segm.hpp",
|
||||
"../objdetect/include/opencv2/objdetect/objdetect.hpp",
|
||||
"../highgui/include/opencv2/highgui/highgui.hpp",
|
||||
"../../core/include/opencv2/core/core.hpp",
|
||||
"../../ml/include/opencv2/ml/ml.hpp",
|
||||
"../../imgproc/include/opencv2/imgproc/imgproc.hpp",
|
||||
"../../calib3d/include/opencv2/calib3d/calib3d.hpp",
|
||||
"../../features2d/include/opencv2/features2d/features2d.hpp",
|
||||
"../../video/include/opencv2/video/tracking.hpp",
|
||||
"../../video/include/opencv2/video/background_segm.hpp",
|
||||
"../../objdetect/include/opencv2/objdetect/objdetect.hpp",
|
||||
"../../highgui/include/opencv2/highgui/highgui.hpp",
|
||||
"opencv_extra_api.hpp",
|
||||
]
|
||||
|
||||
@ -375,6 +375,22 @@ class CppHeaderParser(object):
|
||||
if eqpos >= 0:
|
||||
a = a[:eqpos].strip()
|
||||
arg_type, arg_name, modlist, argno = self.parse_arg(a, argno)
|
||||
if arg_type == "InputArray" or arg_type == "InputOutputArray":
|
||||
arg_type = "Mat"
|
||||
elif arg_type == "OutputArray":
|
||||
arg_type = "Mat"
|
||||
modlist.append("/O")
|
||||
elif arg_type == "InputArrayOfArrays" or arg_type == "InputOutputArrayOfArrays":
|
||||
arg_type = "vector_Mat"
|
||||
elif arg_type == "OutputArrayOfArrays":
|
||||
arg_type = "vector_Mat"
|
||||
modlist.append("/O")
|
||||
defval = self.batch_replace(defval, [("InputArrayOfArrays", "vector<Mat>"),
|
||||
("InputOutputArrayOfArrays", "vector<Mat>"),
|
||||
("OutputArrayOfArrays", "vector<Mat>"),
|
||||
("InputArray", "Mat"),
|
||||
("InputOutputArray", "Mat"),
|
||||
("OutputArray", "Mat")]).strip()
|
||||
args.append([arg_type, arg_name, defval, modlist])
|
||||
npos = arg_start-1
|
||||
|
BIN
modules/python/src/hdr_parser.pyc
Executable file
BIN
modules/python/src/hdr_parser.pyc
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user