nxp의 selfie_segmenter.py 에서 추출한 파이프라인

원래 나온거랑은 약간의 줄 추가가 있을 뿐 순서는 차이가 없음

 

특이(?)하게도 v4lsrc가 가장 처음에 시작하는게 아니라

imxpositor_g2d 라고 입력받은걸 양쪽으로 출력하는 비디오 믹서가 파이프라인의 시작에 존재한다.

imxcompositor_g2d latency=33333333 min-upstream-latency=33333333 name=comp sink_1::ypos=0 sink_0::ypos=0 sink_0::xpos=480 \
! cairooverlay name=cairo_text \
! fpsdisplaysink name=wayland_sink text-overlay=false video-sink=waylandsink \
v4l2src device=/dev/video3 \
! video/x-raw,width=640,height=480,framerate=30/1 \
! aspectratiocrop aspect-ratio=1/1 \
! imxvideoconvert_g2d rotation=horizontal-flip \
! video/x-raw,width=480,height=480 \
! tee name=t \
t. ! queue max-size-buffers=1 leaky=2 \
! imxvideoconvert_g2d \
! video/x-raw,width=256,height=256 \
! videoconvert \
! video/x-raw,format=RGB \
! tensor_converter \
! tensor_transform mode=arithmetic option=typecast:float32,div:255.0 \
! tensor_filter framework=tensorflow-lite model=/opt/gopoint-apps/downloads/selfie_segmenter_int8.tflite accelerator=true:npu custom=Delegate:External,ExtDelegateLib:libvx_delegate.so name=tensor_filter latency=1 \
! tensor_decoder mode=image_segment option1=snpe-depth option2=0 \
! imxvideoconvert_g2d \
! video/x-raw,width=480,height=480,format=RGBA \
! comp.sink_0 \
t. ! queue max-size-buffers=1 leaky=2 \
! comp.sink_1

 

자리를 조금 움직여서 보기 편하게(?) 만들면 아래와 같이

v4lsrc로 시작해서 fpsdisplaysink 로 끝내는 순차적인 구성으로 변경이 가능하다.

v4l2src device=/dev/video3 \
! video/x-raw,width=640,height=480,framerate=30/1 \
! aspectratiocrop aspect-ratio=1/1 \
! imxvideoconvert_g2d rotation=horizontal-flip \
! video/x-raw,width=480,height=480 \
! tee name=t \
t. ! queue max-size-buffers=1 leaky=2 \
! imxvideoconvert_g2d \
! video/x-raw,width=256,height=256 \
! videoconvert \
! video/x-raw,format=RGB \
! tensor_converter \
! tensor_transform mode=arithmetic option=typecast:float32,div:255.0 \
! tensor_filter framework=tensorflow-lite model=/opt/gopoint-apps/downloads/selfie_segmenter_int8.tflite accelerator=true:npu custom=Delegate:External,ExtDelegateLib:libvx_delegate.so name=tensor_filter latency=1 \
! tensor_decoder mode=image_segment option1=snpe-depth option2=0 \
! imxvideoconvert_g2d \
! video/x-raw,width=480,height=480,format=RGBA \
! imxcompositor_g2d latency=33333333 min-upstream-latency=33333333 name=comp sink_1::ypos=0 sink_0::ypos=0 sink_0::xpos=480 \
! cairooverlay name=cairo_text \
! fpsdisplaysink name=wayland_sink text-overlay=false video-sink=waylandsink \
t. ! queue max-size-buffers=1 leaky=2 \
! comp.sink_1

 

tee 로 나눈걸 다시 명시적으로 하는걸 생략하면 아래처럼도 변형가능하다.

v4l2src device=/dev/video3 \
! video/x-raw,width=640,height=480,framerate=30/1 \
! aspectratiocrop aspect-ratio=1/1 \
! imxvideoconvert_g2d rotation=horizontal-flip \
! video/x-raw,width=480,height=480 \
! tee name=t \
! queue max-size-buffers=1 leaky=2 \
! imxvideoconvert_g2d \
! video/x-raw,width=256,height=256 \
! videoconvert \
! video/x-raw,format=RGB \
! tensor_converter \
! tensor_transform mode=arithmetic option=typecast:float32,div:255.0 \
! tensor_filter framework=tensorflow-lite model=/opt/gopoint-apps/downloads/selfie_segmenter_int8.tflite accelerator=true:npu custom=Delegate:External,ExtDelegateLib:libvx_delegate.so name=tensor_filter latency=1 \
! tensor_decoder mode=image_segment option1=snpe-depth option2=0 \
! imxvideoconvert_g2d \
! video/x-raw,width=480,height=480,format=RGBA \
! imxcompositor_g2d latency=33333333 min-upstream-latency=33333333 name=comp sink_1::ypos=0 sink_0::ypos=0 sink_0::xpos=480 \
! cairooverlay name=cairo_text \
! fpsdisplaysink name=wayland_sink text-overlay=false video-sink=waylandsink \
t. \
! queue max-size-buffers=1 leaky=2 \
! comp.sink_1

'프로그램 사용 > gstreamer' 카테고리의 다른 글

gstreamer 기초  (0) 2025.08.27
gstreamer tee 예제  (0) 2025.08.21
gstreamer capsfilter  (0) 2025.08.21
gstreamer parse_launch  (0) 2024.01.11
nnstreamer  (0) 2023.12.20
Posted by 구차니