Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
6977a895
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,发现更多精彩内容 >>
提交
6977a895
编写于
7月 02, 2012
作者:
A
Alexander Mordvintsev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
descriptions for watershed.py and video.py
上级
d015bf6f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
15 deletion
+54
-15
samples/python2/fitline.py
samples/python2/fitline.py
+2
-0
samples/python2/video.py
samples/python2/video.py
+31
-7
samples/python2/watershed.py
samples/python2/watershed.py
+21
-8
未找到文件。
samples/python2/fitline.py
浏览文件 @
6977a895
...
...
@@ -63,6 +63,8 @@ def update(_=None):
cv2
.
imshow
(
'fit line'
,
img
)
if
__name__
==
'__main__'
:
print
__doc__
cv2
.
namedWindow
(
'fit line'
)
cv2
.
createTrackbar
(
'noise'
,
'fit line'
,
3
,
50
,
update
)
cv2
.
createTrackbar
(
'point n'
,
'fit line'
,
100
,
500
,
update
)
...
...
samples/python2/video.py
浏览文件 @
6977a895
'''
Video capture sample.
Sample shows how VideoCapture class can be used to acquire video
frames from a camera of a movie file. Also the sample provides
an example of procedural video generation by an object, mimicking
the VideoCapture interface (see Chess class).
'create_capture' is a convinience function for capture creation,
falling back to procedural video in case of error.
Usage:
video.py [--shotdir <shot path>] [source0] [source1] ...'
sourceN is an
- integer number for camera capture
- name of video file
- synth:<params> for procedural video
Synth examples:
synth:bg=../cpp/lena.jpg:noise=0.1
synth:class=chess:bg=../cpp/lena.jpg:noise=0.1:size=640x480
Keys:
ESC - exit
SPACE - save current frame to <shot path> directory
'''
import
numpy
as
np
import
cv2
from
time
import
clock
...
...
@@ -100,8 +129,7 @@ presets = dict(
def
create_capture
(
source
=
0
,
fallback
=
presets
[
'chess'
]):
'''
source: <int> or '<int>|<filename>|synth [:<param_name>=<value> [:...]]'
'''source: <int> or '<int>|<filename>|synth [:<param_name>=<value> [:...]]'
'''
source
=
str
(
source
).
strip
()
chunks
=
source
.
split
(
':'
)
...
...
@@ -136,9 +164,7 @@ if __name__ == '__main__':
import
sys
import
getopt
print
'USAGE: video.py [--shotdir <dir>] [source0] [source1] ...'
print
"source: '<int>' or '<filename>' or 'synth:<params>'"
print
print
__doc__
args
,
sources
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
''
,
'shotdir='
)
args
=
dict
(
args
)
...
...
@@ -146,8 +172,6 @@ if __name__ == '__main__':
if
len
(
sources
)
==
0
:
sources
=
[
0
]
print
'Press SPACE to save current frame'
caps
=
map
(
create_capture
,
sources
)
shot_idx
=
0
while
True
:
...
...
samples/python2/watershed.py
浏览文件 @
6977a895
import
numpy
as
np
import
cv2
from
common
import
Sketcher
'''
Watershed segmentation
=========
This program demonstrates the watershed segmentation algorithm
in OpenCV: watershed().
help_message
=
'''
USAGE: watershed.py [<image>]
Usage
-----
watershed.py [image filename]
Use keys 1 - 7 to switch marker color
Keys
----
1-7 - switch marker color
SPACE - update segmentation
r - reset
a -
switch
autoupdate
a -
toggle
autoupdate
ESC - exit
'''
import
numpy
as
np
import
cv2
from
common
import
Sketcher
class
App
:
def
__init__
(
self
,
fn
):
self
.
img
=
cv2
.
imread
(
fn
)
...
...
@@ -60,5 +73,5 @@ if __name__ == '__main__':
import
sys
try
:
fn
=
sys
.
argv
[
1
]
except
:
fn
=
'../cpp/fruits.jpg'
print
help_message
print
__doc__
App
(
fn
).
run
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录