deepstream保存pipeline圖片

  1. 安裝依賴
$ sudo apt-get install graphviz
  1. 添加自定義保存pipeline路徑的環境變量
$ sudo gedit ~/.bashrc

export GST_DEBUG_DUMP_DOT_DIR=/home/dreamdeck/Documents/code/pipeline/

$ source ~/.bashrc
  1. 修改deepstream源碼。在 g_main_loop_run(main_loop);後面添加如下代碼:
/*GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS   with timestamp */
    /*print pipeline*/
    GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN (appCtx[0]->pipeline.pipeline),
                   GST_DEBUG_GRAPH_SHOW_ALL, "pipeline-playing");

注意修改appCtx[0]->pipeline.pipeline,這裏應該是pipeline。

  1. 繪製矢量圖(圖太大時位圖放大像素低,看不清),如果批量繪製,請直接跳轉步驟5
$ cd /home/nvidia/pipeline/
$ dot -Tsvg pipeline-playing.dot > pipeline-playing.pdf
  1. 批量繪製

新建.sh文件

$ touch gen-pipeline.sh

編寫.sh腳本(注意空行)


#!/bin/sh
INPUT_DIR="/home/dreamdeck/Documents/code/pipeline/"
DOT_FILES="${INPUT_DIR}*.dot"
for file in $DOT_FILES
do
    dest=`sed s/.dot/.svg/ <<< "$file"`
    dot -Tsvg $file > $dest
done

賦權限並批量生成

sudo chmod +x gen-pipeline.sh
./gen-pipeline.sh
  1. 通過瀏覽器打開矢量圖
    在這裏插入圖片描述
    (圖片爲部分結果截取)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章