deepstream生成pipeline拓扑图的方法

编程入门 行业动态 更新时间:2024-10-27 00:24:00

deepstream生成pipeline拓扑图的<a href=https://www.elefans.com/category/jswz/34/1771314.html style=方法"/>

deepstream生成pipeline拓扑图的方法

deepstream生成pipeline拓扑图的方法

    • 1、前期工作
      • 1.1 安装dot
    • 2、使用命令行生成
      • 2.1、添加环境变量
      • 2.2 、运行管道
      • 2.3 、使用dot 生成png图片
    • 3、在c中使用
      • 3.1、添加代码
      • 3.2、运行代码
      • 3.3 、使用dot 生成png图片
    • 4、在python中使用
      • 4.1、添加代码
      • 4.2 、使用dot 生成png图片

1、前期工作

1.1 安装dot

 sudo apt-get install graphviz

2、使用命令行生成

2.1、添加环境变量

export GST_DEBUG_DUMP_DOT_DIR=/Comac/Project/deepstream/dot  # /home/hiccup/gst_pipeline路径可以随意改变,为生成的.dot pipeline拓扑结构图

2.2 、运行管道

gst-launch-1.0 v4l2src device="/dev/video0" ! "video/x-raw, width=640, height=480, format=(string)YUY2" ! xvimagesink -e

管道结束后,可以在“/Comac/Project/deepstream/dot”下看到.dot生成的文件“ds-tracker-pipeline.dot”,其中“ds-tracker-pipeline”是定义的pipeline的名字

2.3 、使用dot 生成png图片

dot -Tpng ds-tracker-pipeline.dot > ds-tracker-pipeline.png


橘黄色:src element 和 src pad
紫色:sink element 和 sink pad
绿色:一般的element(除src element 和sink element外)

3、在c中使用

3.1、添加代码

在启动管道pipeline前加入如下代码,其中字符"pipeline"需要换成创建pipeline时命名的名字,例如“ds-tracker-pipeline”

GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");
// 或者
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");
gst_element_set_state(pipeline, GST_STATE_PLAYING); //启动管道

3.2、运行代码

运行应用程序时前缀加上如下代码,其中路径"/Comac/Project/deepstream/dot"为生成的.dot pipeline拓扑结构图的路径

GST_DEBUG_DUMP_DOT_DIR=/Comac/Project/deepstream/dot ./ds_app_multi file:///Comac/Project/deepstream/ds_tracker/media/55.mp4

3.3 、使用dot 生成png图片

dot -Tpng ds-tracker-pipeline.dot > ds-tracker-pipeline.png

4、在python中使用

4.1、添加代码

在import处添加

import os
os.environ["GST_DEBUG_DUMP_DOT_DIR"] = "/Comac/Project/deepstream/dot"
os.putenv('GST_DEBUG_DUMP_DIR_DIR', '/Comac/Project/deepstream/dot')

在启动管道pipeline前加入如下代码:

Gst.debug_bin_to_dot_file(pipeline, Gst.DebugGraphDetails.ALL, "pipeline")
# start play back and listen to events
print("Starting pipeline \n")
pipeline.set_state(Gst.State.PLAYING)
try:loop.run()
except:pass
# cleanup
pipeline.set_state(Gst.State.NULL)

4.2 、使用dot 生成png图片

dot -Tpng ds-tracker-pipeline.dot > ds-tracker-pipeline.png

更多推荐

deepstream生成pipeline拓扑图的方法

本文发布于:2023-11-15 00:56:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1590818.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方法   拓扑图   deepstream   pipeline

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!