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
1310dc4c
Commit
1310dc4c
authored
Jul 28, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2994 from znah:py_hpp_glob
parents
50a1def8
586ace18
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
34 deletions
+44
-34
CMakeLists.txt
modules/python/CMakeLists.txt
+32
-26
gen2.py
modules/python/src2/gen2.py
+4
-2
hdr_parser.py
modules/python/src2/hdr_parser.py
+2
-0
hist_cost.hpp
modules/shape/include/opencv2/shape/hist_cost.hpp
+4
-4
shape_distance.hpp
modules/shape/include/opencv2/shape/shape_distance.hpp
+2
-2
No files found.
modules/python/CMakeLists.txt
View file @
1310dc4c
...
...
@@ -11,7 +11,25 @@ if(ANDROID OR IOS OR NOT PYTHONLIBS_FOUND OR NOT PYTHON_NUMPY_INCLUDE_DIRS)
endif
()
set
(
the_description
"The python bindings"
)
ocv_add_module
(
python BINDINGS opencv_core opencv_flann opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_imgcodecs opencv_videoio opencv_highgui opencv_calib3d opencv_photo opencv_objdetect OPTIONAL opencv_nonfree
)
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_adas$"
)
ocv_list_filterout
(
candidate_deps
"^opencv_tracking$"
)
ocv_add_module
(
python BINDINGS OPTIONAL
${
candidate_deps
}
)
ocv_module_include_directories
(
"
${
PYTHON_INCLUDE_PATH
}
"
...
...
@@ -19,31 +37,17 @@ ocv_module_include_directories(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src2"
)
set
(
opencv_hdrs
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core.hpp"
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core/base.hpp"
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core/types.hpp"
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core/persistence.hpp"
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core/utility.hpp"
"
${
OPENCV_MODULE_opencv_core_LOCATION
}
/include/opencv2/core/ocl.hpp"
"
${
OPENCV_MODULE_opencv_flann_LOCATION
}
/include/opencv2/flann/miniflann.hpp"
"
${
OPENCV_MODULE_opencv_imgproc_LOCATION
}
/include/opencv2/imgproc.hpp"
"
${
OPENCV_MODULE_opencv_video_LOCATION
}
/include/opencv2/video/background_segm.hpp"
"
${
OPENCV_MODULE_opencv_video_LOCATION
}
/include/opencv2/video/tracking.hpp"
"
${
OPENCV_MODULE_opencv_photo_LOCATION
}
/include/opencv2/photo.hpp"
"
${
OPENCV_MODULE_opencv_imgcodecs_LOCATION
}
/include/opencv2/imgcodecs.hpp"
"
${
OPENCV_MODULE_opencv_videoio_LOCATION
}
/include/opencv2/videoio.hpp"
"
${
OPENCV_MODULE_opencv_highgui_LOCATION
}
/include/opencv2/highgui.hpp"
"
${
OPENCV_MODULE_opencv_ml_LOCATION
}
/include/opencv2/ml.hpp"
"
${
OPENCV_MODULE_opencv_features2d_LOCATION
}
/include/opencv2/features2d.hpp"
"
${
OPENCV_MODULE_opencv_calib3d_LOCATION
}
/include/opencv2/calib3d.hpp"
"
${
OPENCV_MODULE_opencv_objdetect_LOCATION
}
/include/opencv2/objdetect.hpp"
)
if
(
HAVE_opencv_nonfree
)
list
(
APPEND opencv_hdrs
"
${
OPENCV_MODULE_opencv_nonfree_LOCATION
}
/include/opencv2/nonfree/features2d.hpp"
"
${
OPENCV_MODULE_opencv_nonfree_LOCATION
}
/include/opencv2/nonfree.hpp"
)
endif
()
set
(
opencv_hdrs
""
)
foreach
(
m IN LISTS OPENCV_MODULE_opencv_python_DEPS
)
list
(
APPEND opencv_hdrs
${
OPENCV_MODULE_
${
m
}
_HEADERS
}
)
endforeach
(
m
)
# header blacklist
ocv_list_filterout
(
opencv_hdrs
".h$"
)
ocv_list_filterout
(
opencv_hdrs
"opencv2/core/cuda"
)
ocv_list_filterout
(
opencv_hdrs
"opencv2/objdetect/detection_based_tracker.hpp"
)
ocv_list_filterout
(
opencv_hdrs
"opencv2/optim.hpp"
)
set
(
cv2_generated_hdrs
"
${
CMAKE_CURRENT_BINARY_DIR
}
/pyopencv_generated_include.h"
...
...
@@ -53,11 +57,13 @@ set(cv2_generated_hdrs
"
${
CMAKE_CURRENT_BINARY_DIR
}
/pyopencv_generated_type_reg.h"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/pyopencv_generated_const_reg.h"
)
file
(
WRITE
"
${
CMAKE_CURRENT_BINARY_DIR
}
/headers.txt"
"
${
opencv_hdrs
}
"
)
add_custom_command
(
OUTPUT
${
cv2_generated_hdrs
}
COMMAND
${
PYTHON_EXECUTABLE
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src2/gen2.py"
${
CMAKE_CURRENT_BINARY_DIR
}
${
opencv_hdrs
}
COMMAND
${
PYTHON_EXECUTABLE
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src2/gen2.py"
${
CMAKE_CURRENT_BINARY_DIR
}
"
${
CMAKE_CURRENT_BINARY_DIR
}
/headers.txt"
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/src2/gen2.py
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/src2/hdr_parser.py
DEPENDS
${
CMAKE_CURRENT_BINARY_DIR
}
/headers.txt
DEPENDS
${
opencv_hdrs
}
)
add_library
(
${
the_module
}
SHARED src2/cv2.cpp
${
cv2_generated_hdrs
}
)
...
...
modules/python/src2/gen2.py
View file @
1310dc4c
...
...
@@ -831,8 +831,10 @@ class PythonWrapperGenerator(object):
# step 1: scan the headers and build more descriptive maps of classes, consts, functions
for
hdr
in
srcfiles
:
self
.
code_include
.
write
(
'#include "{}"
\n
'
.
format
(
hdr
[
hdr
.
rindex
(
'opencv2/'
):])
)
decls
=
parser
.
parse
(
hdr
)
if
len
(
decls
)
==
0
:
continue
self
.
code_include
.
write
(
'#include "{}"
\n
'
.
format
(
hdr
[
hdr
.
rindex
(
'opencv2/'
):])
)
for
decl
in
decls
:
name
=
decl
[
0
]
if
name
.
startswith
(
"struct"
)
or
name
.
startswith
(
"class"
):
...
...
@@ -901,6 +903,6 @@ if __name__ == "__main__":
if
len
(
sys
.
argv
)
>
1
:
dstdir
=
sys
.
argv
[
1
]
if
len
(
sys
.
argv
)
>
2
:
srcfiles
=
sys
.
argv
[
2
:]
srcfiles
=
open
(
sys
.
argv
[
2
],
'r'
)
.
read
()
.
split
(
';'
)
generator
=
PythonWrapperGenerator
()
generator
.
gen
(
srcfiles
,
dstdir
)
modules/python/src2/hdr_parser.py
View file @
1310dc4c
...
...
@@ -206,6 +206,8 @@ class CppHeaderParser(object):
def
parse_enum
(
self
,
decl_str
):
l
=
decl_str
ll
=
l
.
split
(
","
)
if
ll
[
-
1
]
.
strip
()
==
""
:
ll
=
ll
[:
-
1
]
prev_val
=
""
prev_val_delta
=
-
1
decl
=
[]
...
...
modules/shape/include/opencv2/shape/hist_cost.hpp
View file @
1310dc4c
...
...
@@ -73,7 +73,7 @@ public:
};
CV_EXPORTS_W
Ptr
<
HistogramCostExtractor
>
createNormHistogramCostExtractor
(
int
flag
=
DIST_L2
,
int
nDummies
=
25
,
float
defaultCost
=
0.2
);
createNormHistogramCostExtractor
(
int
flag
=
DIST_L2
,
int
nDummies
=
25
,
float
defaultCost
=
0.2
f
);
/*! */
class
CV_EXPORTS_W
EMDHistogramCostExtractor
:
public
HistogramCostExtractor
...
...
@@ -84,20 +84,20 @@ public:
};
CV_EXPORTS_W
Ptr
<
HistogramCostExtractor
>
createEMDHistogramCostExtractor
(
int
flag
=
DIST_L2
,
int
nDummies
=
25
,
float
defaultCost
=
0.2
);
createEMDHistogramCostExtractor
(
int
flag
=
DIST_L2
,
int
nDummies
=
25
,
float
defaultCost
=
0.2
f
);
/*! */
class
CV_EXPORTS_W
ChiHistogramCostExtractor
:
public
HistogramCostExtractor
{};
CV_EXPORTS_W
Ptr
<
HistogramCostExtractor
>
createChiHistogramCostExtractor
(
int
nDummies
=
25
,
float
defaultCost
=
0.2
);
CV_EXPORTS_W
Ptr
<
HistogramCostExtractor
>
createChiHistogramCostExtractor
(
int
nDummies
=
25
,
float
defaultCost
=
0.2
f
);
/*! */
class
CV_EXPORTS_W
EMDL1HistogramCostExtractor
:
public
HistogramCostExtractor
{};
CV_EXPORTS_W
Ptr
<
HistogramCostExtractor
>
createEMDL1HistogramCostExtractor
(
int
nDummies
=
25
,
float
defaultCost
=
0.2
);
createEMDL1HistogramCostExtractor
(
int
nDummies
=
25
,
float
defaultCost
=
0.2
f
);
}
// cv
#endif
modules/shape/include/opencv2/shape/shape_distance.hpp
View file @
1310dc4c
...
...
@@ -116,7 +116,7 @@ public:
/* Complete constructor */
CV_EXPORTS_W
Ptr
<
ShapeContextDistanceExtractor
>
createShapeContextDistanceExtractor
(
int
nAngularBins
=
12
,
int
nRadialBins
=
4
,
float
innerRadius
=
0.2
,
float
outerRadius
=
2
,
int
iterations
=
3
,
float
innerRadius
=
0.2
f
,
float
outerRadius
=
2
,
int
iterations
=
3
,
const
Ptr
<
HistogramCostExtractor
>
&
comparer
=
createChiHistogramCostExtractor
(),
const
Ptr
<
ShapeTransformer
>
&
transformer
=
createThinPlateSplineShapeTransformer
());
...
...
@@ -137,7 +137,7 @@ public:
};
/* Constructor */
CV_EXPORTS_W
Ptr
<
HausdorffDistanceExtractor
>
createHausdorffDistanceExtractor
(
int
distanceFlag
=
cv
::
NORM_L2
,
float
rankProp
=
0.6
);
CV_EXPORTS_W
Ptr
<
HausdorffDistanceExtractor
>
createHausdorffDistanceExtractor
(
int
distanceFlag
=
cv
::
NORM_L2
,
float
rankProp
=
0.6
f
);
}
// cv
#endif
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