mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
Merge pull request #9050 from alalek:dnn_binding_fixes
This commit is contained in:
commit
c235bbfcb4
@ -46,6 +46,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
#include <opencv2/dnn/dnn.hpp>
|
||||||
|
|
||||||
namespace cv {
|
namespace cv {
|
||||||
namespace dnn {
|
namespace dnn {
|
||||||
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
CV__DNN_EXPERIMENTAL_NS_BEGIN
|
||||||
|
@ -32,13 +32,16 @@ foreach(m ${OPENCV_PYTHON_MODULES})
|
|||||||
endforeach(m)
|
endforeach(m)
|
||||||
|
|
||||||
# header blacklist
|
# header blacklist
|
||||||
ocv_list_filterout(opencv_hdrs "modules/.*.h$")
|
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.h$")
|
||||||
ocv_list_filterout(opencv_hdrs "modules/core/.*/cuda")
|
ocv_list_filterout(opencv_hdrs "modules/core/.*/cuda")
|
||||||
ocv_list_filterout(opencv_hdrs "modules/cuda.*")
|
ocv_list_filterout(opencv_hdrs "modules/cuda.*")
|
||||||
ocv_list_filterout(opencv_hdrs "modules/cudev")
|
ocv_list_filterout(opencv_hdrs "modules/cudev")
|
||||||
ocv_list_filterout(opencv_hdrs "modules/core/.*/hal/")
|
ocv_list_filterout(opencv_hdrs "modules/core/.*/hal/")
|
||||||
ocv_list_filterout(opencv_hdrs "modules/.+/utils/.*")
|
ocv_list_filterout(opencv_hdrs "modules/.+/utils/.*")
|
||||||
ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker.hpp") # Conditional compilation
|
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.inl\\\\.h*")
|
||||||
|
ocv_list_filterout(opencv_hdrs "modules/.*_inl\\\\.h*")
|
||||||
|
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.details\\\\.h*")
|
||||||
|
ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker\\\\.hpp") # Conditional compilation
|
||||||
|
|
||||||
set(cv2_generated_hdrs
|
set(cv2_generated_hdrs
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
|
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
|
||||||
@ -47,7 +50,8 @@ set(cv2_generated_hdrs
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
|
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_ns_reg.h")
|
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_ns_reg.h")
|
||||||
|
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${opencv_hdrs}")
|
string(REPLACE ";" "\n" opencv_hdrs_ "${opencv_hdrs}")
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${opencv_hdrs_}")
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${cv2_generated_hdrs}
|
OUTPUT ${cv2_generated_hdrs}
|
||||||
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${PYTHON_SOURCE_DIR}/src2/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${PYTHON}"
|
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${PYTHON_SOURCE_DIR}/src2/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${PYTHON}"
|
||||||
|
@ -977,6 +977,6 @@ if __name__ == "__main__":
|
|||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
dstdir = sys.argv[1]
|
dstdir = sys.argv[1]
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
srcfiles = open(sys.argv[2], 'r').read().split(';')
|
srcfiles = [f.strip() for f in open(sys.argv[2], 'r').readlines()]
|
||||||
generator = PythonWrapperGenerator()
|
generator = PythonWrapperGenerator()
|
||||||
generator.gen(srcfiles, dstdir)
|
generator.gen(srcfiles, dstdir)
|
||||||
|
@ -769,7 +769,7 @@ class CppHeaderParser(object):
|
|||||||
|
|
||||||
for l0 in linelist:
|
for l0 in linelist:
|
||||||
self.lineno += 1
|
self.lineno += 1
|
||||||
#print self.lineno
|
#print(state, self.lineno, l0)
|
||||||
|
|
||||||
l = l0.strip()
|
l = l0.strip()
|
||||||
|
|
||||||
@ -798,8 +798,13 @@ class CppHeaderParser(object):
|
|||||||
l = l[pos+2:]
|
l = l[pos+2:]
|
||||||
state = SCAN
|
state = SCAN
|
||||||
|
|
||||||
|
if l.startswith('CV__'): # just ignore this lines
|
||||||
|
#print('IGNORE: ' + l)
|
||||||
|
state = SCAN
|
||||||
|
continue
|
||||||
|
|
||||||
if state != SCAN:
|
if state != SCAN:
|
||||||
print("Error at %d: invlid state = %d" % (self.lineno, state))
|
print("Error at %d: invalid state = %d" % (self.lineno, state))
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
@ -848,6 +853,7 @@ class CppHeaderParser(object):
|
|||||||
|
|
||||||
stmt = (block_head + " " + l[:pos]).strip()
|
stmt = (block_head + " " + l[:pos]).strip()
|
||||||
stmt = " ".join(stmt.split()) # normalize the statement
|
stmt = " ".join(stmt.split()) # normalize the statement
|
||||||
|
#print(stmt)
|
||||||
stack_top = self.block_stack[-1]
|
stack_top = self.block_stack[-1]
|
||||||
|
|
||||||
if stmt.startswith("@"):
|
if stmt.startswith("@"):
|
||||||
|
Loading…
Reference in New Issue
Block a user