Skip to content

Commit c235bbf

Browse files
committed
Merge pull request opencv#9050 from alalek:dnn_binding_fixes
2 parents a84a5e8 + 6ea6e4b commit c235bbf

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

modules/dnn/include/opencv2/dnn/dict.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <map>
4747
#include <ostream>
4848

49+
#include <opencv2/dnn/dnn.hpp>
50+
4951
namespace cv {
5052
namespace dnn {
5153
CV__DNN_EXPERIMENTAL_NS_BEGIN

modules/python/common.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ foreach(m ${OPENCV_PYTHON_MODULES})
3232
endforeach(m)
3333

3434
# header blacklist
35-
ocv_list_filterout(opencv_hdrs "modules/.*.h$")
35+
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.h$")
3636
ocv_list_filterout(opencv_hdrs "modules/core/.*/cuda")
3737
ocv_list_filterout(opencv_hdrs "modules/cuda.*")
3838
ocv_list_filterout(opencv_hdrs "modules/cudev")
3939
ocv_list_filterout(opencv_hdrs "modules/core/.*/hal/")
4040
ocv_list_filterout(opencv_hdrs "modules/.+/utils/.*")
41-
ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker.hpp") # Conditional compilation
41+
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.inl\\\\.h*")
42+
ocv_list_filterout(opencv_hdrs "modules/.*_inl\\\\.h*")
43+
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.details\\\\.h*")
44+
ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker\\\\.hpp") # Conditional compilation
4245

4346
set(cv2_generated_hdrs
4447
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
@@ -47,7 +50,8 @@ set(cv2_generated_hdrs
4750
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
4851
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_ns_reg.h")
4952

50-
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${opencv_hdrs}")
53+
string(REPLACE ";" "\n" opencv_hdrs_ "${opencv_hdrs}")
54+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${opencv_hdrs_}")
5155
add_custom_command(
5256
OUTPUT ${cv2_generated_hdrs}
5357
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${PYTHON_SOURCE_DIR}/src2/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${PYTHON}"

modules/python/src2/gen2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,6 @@ def gen(self, srcfiles, output_path):
977977
if len(sys.argv) > 1:
978978
dstdir = sys.argv[1]
979979
if len(sys.argv) > 2:
980-
srcfiles = open(sys.argv[2], 'r').read().split(';')
980+
srcfiles = [f.strip() for f in open(sys.argv[2], 'r').readlines()]
981981
generator = PythonWrapperGenerator()
982982
generator.gen(srcfiles, dstdir)

modules/python/src2/hdr_parser.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def parse(self, hname, wmode=True):
769769

770770
for l0 in linelist:
771771
self.lineno += 1
772-
#print self.lineno
772+
#print(state, self.lineno, l0)
773773

774774
l = l0.strip()
775775

@@ -798,8 +798,13 @@ def parse(self, hname, wmode=True):
798798
l = l[pos+2:]
799799
state = SCAN
800800

801+
if l.startswith('CV__'): # just ignore this lines
802+
#print('IGNORE: ' + l)
803+
state = SCAN
804+
continue
805+
801806
if state != SCAN:
802-
print("Error at %d: invlid state = %d" % (self.lineno, state))
807+
print("Error at %d: invalid state = %d" % (self.lineno, state))
803808
sys.exit(-1)
804809

805810
while 1:
@@ -848,6 +853,7 @@ def parse(self, hname, wmode=True):
848853

849854
stmt = (block_head + " " + l[:pos]).strip()
850855
stmt = " ".join(stmt.split()) # normalize the statement
856+
#print(stmt)
851857
stack_top = self.block_stack[-1]
852858

853859
if stmt.startswith("@"):

0 commit comments

Comments
 (0)