Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
22b028b6
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,发现更多精彩内容 >>
提交
22b028b6
编写于
2月 24, 2016
作者:
V
Vladislav Sovrasov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix warnings in python3
上级
e4fed417
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
14 addition
and
32 deletion
+14
-32
modules/python/test/test.py
modules/python/test/test.py
+1
-1
modules/python/test/test_grabcut.py
modules/python/test/test_grabcut.py
+5
-5
modules/python/test/test_watershed.py
modules/python/test/test_watershed.py
+3
-21
modules/python/test/tst_scene_render.py
modules/python/test/tst_scene_render.py
+5
-5
未找到文件。
modules/python/test/test.py
浏览文件 @
22b028b6
...
...
@@ -136,7 +136,7 @@ if __name__ == '__main__':
try
:
NewOpenCVTests
.
extraTestDataPath
=
os
.
environ
[
'OPENCV_TEST_DATA_PATH'
]
except
KeyError
:
p
ass
p
rint
(
'Missing opencv extra repository. Some of tests may fail.'
)
random
.
seed
(
0
)
unit_argv
=
[
sys
.
argv
[
0
]]
+
other
;
unittest
.
main
(
argv
=
unit_argv
)
\ No newline at end of file
modules/python/test/test_grabcut.py
浏览文件 @
22b028b6
...
...
@@ -35,8 +35,8 @@ class grabcut_test(NewOpenCVTests):
exp_mask1
=
self
.
get_sample
(
"cv/grabcut/exp_mask1py.png"
,
0
)
exp_mask2
=
self
.
get_sample
(
"cv/grabcut/exp_mask2py.png"
,
0
)
if
img
==
None
:
self
.
assert
Equal
(
0
,
1
,
'Missing test data'
)
if
img
is
None
:
self
.
assert
True
(
False
,
'Missing test data'
)
rect
=
(
24
,
126
,
459
,
168
)
mask
=
np
.
zeros
(
img
.
shape
[:
2
],
dtype
=
np
.
uint8
)
...
...
@@ -45,10 +45,10 @@ class grabcut_test(NewOpenCVTests):
cv2
.
grabCut
(
img
,
mask
,
rect
,
bgdModel
,
fgdModel
,
0
,
cv2
.
GC_INIT_WITH_RECT
)
cv2
.
grabCut
(
img
,
mask
,
rect
,
bgdModel
,
fgdModel
,
2
,
cv2
.
GC_EVAL
)
if
mask_prob
==
None
:
if
mask_prob
is
None
:
mask_prob
=
mask
.
copy
()
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/grabcut/mask_probpy.png'
,
mask_prob
)
if
exp_mask1
==
None
:
if
exp_mask1
is
None
:
exp_mask1
=
self
.
scaleMask
(
mask
)
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/grabcut/exp_mask1py.png'
,
exp_mask1
)
...
...
@@ -60,7 +60,7 @@ class grabcut_test(NewOpenCVTests):
cv2
.
grabCut
(
img
,
mask
,
rect
,
bgdModel
,
fgdModel
,
0
,
cv2
.
GC_INIT_WITH_MASK
)
cv2
.
grabCut
(
img
,
mask
,
rect
,
bgdModel
,
fgdModel
,
1
,
cv2
.
GC_EVAL
)
if
exp_mask2
==
None
:
if
exp_mask2
is
None
:
exp_mask2
=
self
.
scaleMask
(
mask
)
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/grabcut/exp_mask2py.png'
,
exp_mask2
)
...
...
modules/python/test/test_watershed.py
浏览文件 @
22b028b6
#!/usr/bin/env python
'''
Watershed segmentation
=========
This program demonstrates the watershed segmentation algorithm
in OpenCV: watershed().
Usage
-----
watershed.py [image filename]
Keys
----
1-7 - switch marker color
SPACE - update segmentation
r - reset
a - toggle autoupdate
ESC - exit
Watershed segmentation test
'''
# Python 2/3 compatibility
from
__future__
import
print_function
...
...
@@ -37,14 +19,14 @@ class watershed_test(NewOpenCVTests):
markers
=
self
.
get_sample
(
'cv/watershed/wshed_exp.png'
,
0
)
refSegments
=
self
.
get_sample
(
'cv/watershed/wshed_segments.png'
)
if
img
==
None
or
markers
==
None
:
if
img
is
None
or
markers
is
None
:
self
.
assertEqual
(
0
,
1
,
'Missing test data'
)
colors
=
np
.
int32
(
list
(
np
.
ndindex
(
3
,
3
,
3
))
)
*
122
cv2
.
watershed
(
img
,
np
.
int32
(
markers
))
segments
=
colors
[
np
.
maximum
(
markers
,
0
)]
if
refSegments
==
None
:
if
refSegments
is
None
:
refSegments
=
segments
.
copy
()
cv2
.
imwrite
(
self
.
extraTestDataPath
+
'/cv/watershed/wshed_segments.png'
,
refSegments
)
...
...
modules/python/test/tst_scene_render.py
浏览文件 @
22b028b6
...
...
@@ -21,7 +21,7 @@ class TestSceneRender():
self
.
noise
=
noise
self
.
speed
=
speed
if
bgImg
!=
None
:
if
bgImg
is
not
None
:
self
.
sceneBg
=
bgImg
.
copy
()
else
:
self
.
sceneBg
=
np
.
zeros
(
defaultSize
,
defaultSize
,
np
.
uint8
)
...
...
@@ -29,7 +29,7 @@ class TestSceneRender():
self
.
w
=
self
.
sceneBg
.
shape
[
0
]
self
.
h
=
self
.
sceneBg
.
shape
[
1
]
if
fgImg
!=
None
:
if
fgImg
is
not
None
:
self
.
foreground
=
fgImg
.
copy
()
self
.
center
=
self
.
currentCenter
=
(
int
(
self
.
w
/
2
-
fgImg
.
shape
[
0
]
/
2
),
int
(
self
.
h
/
2
-
fgImg
.
shape
[
1
]
/
2
))
...
...
@@ -53,7 +53,7 @@ class TestSceneRender():
def
getRectInTime
(
self
,
time
):
if
self
.
foreground
!=
None
:
if
self
.
foreground
is
not
None
:
tmp
=
np
.
array
(
self
.
center
)
+
np
.
array
((
self
.
getXOffset
(
time
),
self
.
getYOffset
(
time
)))
x0
,
y0
=
tmp
x1
,
y1
=
tmp
+
self
.
foreground
.
shape
[
0
:
2
]
...
...
@@ -65,7 +65,7 @@ class TestSceneRender():
def
getCurrentRect
(
self
):
if
self
.
foreground
!=
None
:
if
self
.
foreground
is
not
None
:
x0
=
self
.
currentCenter
[
0
]
y0
=
self
.
currentCenter
[
1
]
...
...
@@ -80,7 +80,7 @@ class TestSceneRender():
def
getNextFrame
(
self
):
img
=
self
.
sceneBg
.
copy
()
if
self
.
foreground
!=
None
:
if
self
.
foreground
is
not
None
:
self
.
currentCenter
=
(
self
.
center
[
0
]
+
self
.
getXOffset
(
self
.
time
),
self
.
center
[
1
]
+
self
.
getYOffset
(
self
.
time
))
img
[
self
.
currentCenter
[
0
]:
self
.
currentCenter
[
0
]
+
self
.
foreground
.
shape
[
0
],
self
.
currentCenter
[
1
]:
self
.
currentCenter
[
1
]
+
self
.
foreground
.
shape
[
1
]]
=
self
.
foreground
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录