从图像、视频或类似的图层中合成最终输出。
layered-vision的Python项目详细描述
分层视觉
本项目的目标是:
- 允许通过配置文件(如虚拟网络摄像头)合成图像或视频的工具。在
这个项目仍处于试验阶段,可能会有重大变化。在
安装
pip install layered-vision
配置
配置格式为file is YAML。在
有很多example configuration files。在
层
每个配置文件都将包含层。层通常是自上而下描述的。 最后一层通常是输出层。在
输出层的源将是上面的层。在
下载numpy
徽标并将其保存到文件中的一个非常简单的配置文件可能如下所示(example-config/save-image.yml
):
您还可以有两个输出(example-config/two-outputs.yml
):
layers:-id:ininput_path:"https://github.com/numpy/numpy/raw/master/branding/logo/logomark/numpylogoicon.png"-id:out1output_path:"data/numpy-logo1.png"-id:out2output_path:"data/numpy-logo2.png"
在这种情况下,out1
和out2
的源层都是in
。在
通过使用window
作为output_path
,图像将显示在一个窗口(example-config/display-image.yml
):
layers:-id:ininput_path:"https://github.com/numpy/numpy/raw/master/branding/logo/logomark/numpylogoicon.png"width:480height:300repeat:true-id:outoutput_path:window
输入层
具有input_path
属性的层。在
当前支持以下输入:
- 图像
- 视频
- Linux网络摄像头(
/dev/videoN
)
input_path
可能指向一个远程位置(与all examples一样)。在这种情况下,它将被下载并在本地缓存。在
过滤层
{cda}具有^属性的层。在
当前支持以下筛选器:
name | description |
---|---|
^{ | Blurs the image or channel. |
^{ | Uses the bodypix model to mask a person. |
^{ | Uses a chroma key (colour) to add a mask |
^{ | Copies the input. Mainly useful as a placeholder layer with ^{ |
^{ | Dilates the image or channel. For example to increase the alpha mask after using ^{ |
^{ | Erodes the image or channel. That could be useful to remove outliers from an alpha mask. |
^{ | Adds a motion blur to the image or channel. That could be used to make an alpha mask move more slowly |
^{ | Pixelates the input. |
每个filter都可能有其他属性。请参考examples(或以后再来)了解更多详细信息。在
分支层
具有branches
属性的层。
每个branch都需要有一个layers
属性。
每组branch layers的输入是对branchs层的输入。
然后将分支合并(在彼此之上添加)。
要使branches有用,至少最后一个branch image应该有一个alpha掩码。在
命令行接口
CLI帮助
python -m layered_vision --help
或者
python -m layered_vision <sub command> --help
示例命令
python -m layered_vision start --config-file=example-config/display-image.yml
您还可以从远程位置加载配置:
python -m layered_vision start --config-file \"https://raw.githubusercontent.com/de-code/layered-vision/develop/example-config/display-video-chroma-key-replace-background.yml"
致谢
- virtual_webcam_background,有点类似的项目(更关注bodypix)
- OBS Studio,概念上的灵感来源。(带用户界面等)
- 项目
标签: