Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
e368f17c
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e368f17c
编写于
7月 30, 2014
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed python bindings generation
上级
ba3783d2
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
12 addition
and
15 deletion
+12
-15
modules/python/src2/cv2.cpp
modules/python/src2/cv2.cpp
+1
-8
modules/python/src2/gen2.py
modules/python/src2/gen2.py
+3
-3
modules/python/src2/hdr_parser.py
modules/python/src2/hdr_parser.py
+8
-4
未找到文件。
modules/python/src2/cv2.cpp
浏览文件 @
e368f17c
...
...
@@ -10,6 +10,7 @@
#include <numpy/ndarrayobject.h>
#include "pyopencv_generated_include.h"
#include "opencv2/core/types_c.h"
#include "opencv2/opencv_modules.hpp"
...
...
@@ -1089,14 +1090,6 @@ bool pyopencv_to(PyObject* obj, CvSlice& r, const char* name)
return
PyArg_ParseTuple
(
obj
,
"ii"
,
&
r
.
start_index
,
&
r
.
end_index
)
>
0
;
}
template
<
>
PyObject
*
pyopencv_from
(
CvDTreeNode
*
const
&
node
)
{
double
value
=
node
->
value
;
int
ivalue
=
cvRound
(
value
);
return
value
==
ivalue
?
PyInt_FromLong
(
ivalue
)
:
PyFloat_FromDouble
(
value
);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
static
void
OnMouse
(
int
event
,
int
x
,
int
y
,
int
flags
,
void
*
param
)
...
...
modules/python/src2/gen2.py
浏览文件 @
e368f17c
...
...
@@ -267,7 +267,7 @@ class ClassInfo(object):
#return sys.exit(-1)
if
self
.
bases
and
self
.
bases
[
0
].
startswith
(
"cv::"
):
self
.
bases
[
0
]
=
self
.
bases
[
0
][
4
:]
if
self
.
bases
and
self
.
bases
[
0
]
==
"Algorithm"
:
if
self
.
bases
and
self
.
bases
[
0
]
==
"
cv::
Algorithm"
:
self
.
isalgorithm
=
True
for
m
in
decl
[
2
]:
if
m
.
startswith
(
"="
):
...
...
@@ -286,7 +286,7 @@ class ClassInfo(object):
code
=
"static bool pyopencv_to(PyObject* src, %s& dst, const char* name)
\n
{
\n
PyObject* tmp;
\n
bool ok;
\n
"
%
(
self
.
cname
)
code
+=
""
.
join
([
gen_template_set_prop_from_map
.
substitute
(
propname
=
p
.
name
,
proptype
=
p
.
tp
)
for
p
in
self
.
props
])
if
self
.
bases
:
code
+=
"
\n
return pyopencv_to(src, (%s&)dst, name);
\n
}
\n
"
%
all_classes
[
self
.
bases
[
0
]].
cname
code
+=
"
\n
return pyopencv_to(src, (%s&)dst, name);
\n
}
\n
"
%
all_classes
[
self
.
bases
[
0
]
.
replace
(
"::"
,
"_"
)
].
cname
else
:
code
+=
"
\n
return true;
\n
}
\n
"
return
code
...
...
@@ -761,7 +761,7 @@ class PythonWrapperGenerator(object):
sys
.
exit
(
-
1
)
self
.
classes
[
classinfo
.
name
]
=
classinfo
if
classinfo
.
bases
and
not
classinfo
.
isalgorithm
:
classinfo
.
isalgorithm
=
self
.
classes
[
classinfo
.
bases
[
0
]].
isalgorithm
classinfo
.
isalgorithm
=
self
.
classes
[
classinfo
.
bases
[
0
]
.
replace
(
"::"
,
"_"
)
].
isalgorithm
def
add_const
(
self
,
name
,
decl
):
constinfo
=
ConstInfo
(
name
,
decl
[
1
])
...
...
modules/python/src2/hdr_parser.py
浏览文件 @
e368f17c
...
...
@@ -582,6 +582,7 @@ class CppHeaderParser(object):
return
name
if
name
.
startswith
(
"cv."
):
return
name
qualified_name
=
((
"."
in
name
)
or
(
"::"
in
name
))
n
=
""
for
b
in
self
.
block_stack
:
block_type
,
block_name
=
b
[
self
.
BLOCK_TYPE
],
b
[
self
.
BLOCK_NAME
]
...
...
@@ -590,9 +591,12 @@ class CppHeaderParser(object):
if
block_type
not
in
[
"struct"
,
"class"
,
"namespace"
]:
print
(
"Error at %d: there are non-valid entries in the current block stack "
%
(
self
.
lineno
,
self
.
block_stack
))
sys
.
exit
(
-
1
)
if
block_name
:
if
block_name
and
(
block_type
==
"namespace"
or
not
qualified_name
)
:
n
+=
block_name
+
"."
return
n
+
name
.
replace
(
"::"
,
"."
)
n
+=
name
.
replace
(
"::"
,
"."
)
if
n
.
endswith
(
".Algorithm"
):
n
=
"cv.Algorithm"
return
n
def
parse_stmt
(
self
,
stmt
,
end_token
):
"""
...
...
@@ -643,7 +647,7 @@ class CppHeaderParser(object):
classname
=
classname
[
1
:]
decl
=
[
stmt_type
+
" "
+
self
.
get_dotted_name
(
classname
),
""
,
modlist
,
[]]
if
bases
:
decl
[
1
]
=
": "
+
", "
.
join
([
b
if
"::"
in
b
else
self
.
get_dotted_name
(
b
).
replace
(
"."
,
"::"
)
for
b
in
bases
])
decl
[
1
]
=
": "
+
", "
.
join
([
self
.
get_dotted_name
(
b
).
replace
(
"."
,
"::"
)
for
b
in
bases
])
return
stmt_type
,
classname
,
True
,
decl
if
stmt
.
startswith
(
"class"
)
or
stmt
.
startswith
(
"struct"
):
...
...
@@ -658,7 +662,7 @@ class CppHeaderParser(object):
if
(
"CV_EXPORTS_W"
in
stmt
)
or
(
"CV_EXPORTS_AS"
in
stmt
)
or
(
not
self
.
wrap_mode
):
# and ("CV_EXPORTS" in stmt)):
decl
=
[
stmt_type
+
" "
+
self
.
get_dotted_name
(
classname
),
""
,
modlist
,
[]]
if
bases
:
decl
[
1
]
=
": "
+
", "
.
join
([
b
if
"::"
in
b
else
self
.
get_dotted_name
(
b
).
replace
(
"."
,
"::"
)
for
b
in
bases
])
decl
[
1
]
=
": "
+
", "
.
join
([
self
.
get_dotted_name
(
b
).
replace
(
"."
,
"::"
)
for
b
in
bases
])
return
stmt_type
,
classname
,
True
,
decl
if
stmt
.
startswith
(
"enum"
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录