Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
d9185ec2
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
d9185ec2
编写于
8月 22, 2012
作者:
A
Alexander Mordvintesv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added _doc.py -- doc-string ckecking utility
added some sample description
上级
122f5956
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
95 addition
and
36 deletion
+95
-36
samples/python2/_coverage.py
samples/python2/_coverage.py
+21
-16
samples/python2/_doc.py
samples/python2/_doc.py
+14
-0
samples/python2/common.py
samples/python2/common.py
+4
-0
samples/python2/demo.py
samples/python2/demo.py
+4
-0
samples/python2/distrans.py
samples/python2/distrans.py
+11
-6
samples/python2/floodfill.py
samples/python2/floodfill.py
+9
-5
samples/python2/inpaint.py
samples/python2/inpaint.py
+12
-5
samples/python2/morphology.py
samples/python2/morphology.py
+14
-4
samples/python2/squares.py
samples/python2/squares.py
+6
-0
未找到文件。
samples/python2/_coverage.py
浏览文件 @
d9185ec2
'''
Utility for measuring python opencv API coverage by samples.
'''
from
glob
import
glob
import
cv2
import
re
cv2_callable
=
set
([
'cv2.'
+
name
for
name
in
dir
(
cv2
)
if
callable
(
getattr
(
cv2
,
name
)
)])
if
__name__
==
'__main__'
:
cv2_callable
=
set
([
'cv2.'
+
name
for
name
in
dir
(
cv2
)
if
callable
(
getattr
(
cv2
,
name
)
)])
found
=
set
()
for
fn
in
glob
(
'*.py'
):
print
' --- '
,
fn
code
=
open
(
fn
).
read
()
found
|=
set
(
re
.
findall
(
'cv2?\.\w+'
,
code
))
found
=
set
()
for
fn
in
glob
(
'*.py'
):
print
' --- '
,
fn
code
=
open
(
fn
).
read
()
found
|=
set
(
re
.
findall
(
'cv2?\.\w+'
,
code
))
cv2_used
=
found
&
cv2_callable
cv2_unused
=
cv2_callable
-
cv2_used
with
open
(
'unused_api.txt'
,
'w'
)
as
f
:
f
.
write
(
'
\n
'
.
join
(
sorted
(
cv2_unused
)))
cv2_used
=
found
&
cv2_callable
cv2_unused
=
cv2_callable
-
cv2_used
with
open
(
'unused_api.txt'
,
'w'
)
as
f
:
f
.
write
(
'
\n
'
.
join
(
sorted
(
cv2_unused
)))
r
=
1.0
*
len
(
cv2_used
)
/
len
(
cv2_callable
)
print
'
\n
cv2 api coverage: %d / %d (%.1f%%)'
%
(
len
(
cv2_used
),
len
(
cv2_callable
),
r
*
100
)
r
=
1.0
*
len
(
cv2_used
)
/
len
(
cv2_callable
)
print
'
\n
cv2 api coverage: %d / %d (%.1f%%)'
%
(
len
(
cv2_used
),
len
(
cv2_callable
),
r
*
100
)
print
'
\n
old (cv) symbols:'
for
s
in
found
:
if
s
.
startswith
(
'cv.'
):
print
s
print
'
\n
old (cv) symbols:'
for
s
in
found
:
if
s
.
startswith
(
'cv.'
):
print
s
samples/python2/_doc.py
0 → 100644
浏览文件 @
d9185ec2
'''
Scans current directory for *.py files and reports
ones with missing __doc__ string.
'''
from
glob
import
glob
if
__name__
==
'__main__'
:
print
'--- undocumented files:'
for
fn
in
glob
(
'*.py'
):
loc
=
{}
execfile
(
fn
,
loc
)
if
'__doc__'
not
in
loc
:
print
fn
samples/python2/common.py
浏览文件 @
d9185ec2
'''
This module contais some common routines used by other samples.
'''
import
numpy
as
np
import
cv2
import
os
...
...
samples/python2/demo.py
浏览文件 @
d9185ec2
'''
Sample-launcher application.
'''
import
Tkinter
as
tk
from
ScrolledText
import
ScrolledText
from
glob
import
glob
...
...
samples/python2/distrans.py
浏览文件 @
d9185ec2
import
numpy
as
np
import
cv2
import
cv2.cv
as
cv
from
common
import
make_cmap
'''
Distance transform sample.
help_message
=
'''USAGE: distrans.py [<image>]
Usage:
distrans.py [<image>]
Keys:
ESC - exit
v - toggle voronoi mode
'''
import
numpy
as
np
import
cv2
import
cv2.cv
as
cv
from
common
import
make_cmap
if
__name__
==
'__main__'
:
import
sys
try
:
fn
=
sys
.
argv
[
1
]
except
:
fn
=
'../cpp/fruits.jpg'
print
help_message
print
__doc__
img
=
cv2
.
imread
(
fn
,
0
)
cm
=
make_cmap
(
'jet'
)
...
...
samples/python2/floodfill.py
浏览文件 @
d9185ec2
import
numpy
as
np
import
cv2
'''
Floodfill sample.
help_message
=
'''USAGE: floodfill.py [<image>]
Usage:
floodfill.py [<image>]
Click on the image to set seed point
Click on the image to set seed point
Keys:
f - toggle floating range
...
...
@@ -11,11 +12,14 @@ Keys:
ESC - exit
'''
import
numpy
as
np
import
cv2
if
__name__
==
'__main__'
:
import
sys
try
:
fn
=
sys
.
argv
[
1
]
except
:
fn
=
'../cpp/fruits.jpg'
print
help_message
print
__doc__
img
=
cv2
.
imread
(
fn
,
True
)
h
,
w
=
img
.
shape
[:
2
]
...
...
samples/python2/inpaint.py
浏览文件 @
d9185ec2
import
numpy
as
np
import
cv2
from
common
import
Sketcher
'''
Inpainting sample.
Inpainting repairs damage to images by floodfilling
the damage with surrounding image areas.
help_message
=
'''USAGE: inpaint.py [<image>]
Usage:
inpaint.py [<image>]
Keys:
SPACE - inpaint
...
...
@@ -10,11 +13,15 @@ Keys:
ESC - exit
'''
import
numpy
as
np
import
cv2
from
common
import
Sketcher
if
__name__
==
'__main__'
:
import
sys
try
:
fn
=
sys
.
argv
[
1
]
except
:
fn
=
'../cpp/fruits.jpg'
print
help_message
print
__doc__
img
=
cv2
.
imread
(
fn
)
img_mark
=
img
.
copy
()
...
...
samples/python2/morphology.py
浏览文件 @
d9185ec2
'''
Morphology operations.
Usage:
morphology.py [<image>]
Keys:
1 - change operation
2 - change structure element shape
ESC - exit
'''
import
numpy
as
np
import
cv2
if
__name__
==
'__main__'
:
print
__doc__
import
sys
from
itertools
import
cycle
from
common
import
draw_str
...
...
@@ -44,10 +58,6 @@ if __name__ == '__main__':
cv2
.
createTrackbar
(
'op/size'
,
'morphology'
,
12
,
20
,
update
)
cv2
.
createTrackbar
(
'iters'
,
'morphology'
,
1
,
10
,
update
)
update
()
print
"Controls:"
print
" 1 - change operation"
print
" 2 - change structure element shape"
print
while
True
:
ch
=
0xFF
&
cv2
.
waitKey
()
if
ch
==
27
:
...
...
samples/python2/squares.py
浏览文件 @
d9185ec2
'''
Simple "Square Detector" program.
Loads several images sequentially and tries to find squares in each image.
'''
import
numpy
as
np
import
cv2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录