GStreamer Pan Tilt Zoom and Rotate Element - Dragonwing 9075 Pipelines
| GStreamer PTZR |
|---|
| GstPTZR Basics |
| User Guide |
| Getting Started |
| Examples |
| Contact Us |
This page provides example GStreamer pipelines to test GstPTZR features on a Qualcomm RB5/RB6. These pipelines were tested on a Qualcomm Dragonwing 9075 EVK with LU (Linux Ubuntu 24.04).
|
|
Environment
Please, enable the display with the instructions
When building the plugin you might need to install other dependecies for Ubuntu 24.04:
sudo apt update sudo apt-get install -y gtk-doc-tools libgtk2.0-dev libgstreamer-plugins-base1.0-dev libglew-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-gl1.0-0 libunwind-dev ./autogen.sh --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu make sudo make install
If the make command throws this error:
make[3]: Entering directory '/home/ubuntu/gst-ptzr/gst-libs' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/ubuntu/gst-ptzr/gst-libs' make[2]: Leaving directory '/home/ubuntu/gst-ptzr/gst-libs' Making all in sys make[2]: Entering directory '/home/ubuntu/gst-ptzr/sys' make -C opengl make[3]: Entering directory '/home/ubuntu/gst-ptzr/sys/opengl' CC libgstptzr_la-gstplugin.lo CC libgstptzr_la-gstptzr.lo CCLD libgstptzr.la /usr/bin/ld: cannot find -lEGL_adreno: No such file or directory /usr/bin/ld: cannot find -lGLESv2_adreno: No such file or directory collect2: error: ld returned 1 exit status make[3]: *** [Makefile:579: libgstptzr.la] Error 1 make[3]: Leaving directory '/home/ubuntu/gst-ptzr/sys/opengl' make[2]: *** [Makefile:791: opengl] Error 2 make[2]: Leaving directory '/home/ubuntu/gst-ptzr/sys' make[1]: *** [Makefile:596: all-recursive] Error 1 make[1]: Leaving directory '/home/ubuntu/gst-ptzr' make: *** [Makefile:527: all] Error 2
You can add symbolic links for Adreno:
cd /usr/lib/aarch64-linux-gnu sudo ln -s libEGL_adreno.so.1 libEGL_adreno.so sudo ln -s libGLESv2_adreno.so.2 libGLESv2_adreno.so sudo ldconfig
Then run:
make clean make sudo make install
GStreamer pipelines
Same input and output resolution with zoom level 1:
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
You can change the zoom level by changing "zoom-level".
Magnification (zoom level > 1):
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=2 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Reduction (zoom level < 1)
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=0 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
You can perform translations relative to the center of the input image by setting the "pan-level" and "tilt-level" properties or perform translations relative to the current position with "pan-delta" and "tilt-delta".
Translate right (-1 < pan level < 0):
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr pan-level=-1 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Translate left (0 < pan level < 1):
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr pan-level=1 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Translate down (-1 < tilt level < 0):
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr tilt-level=-1 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Translate up (0 < tilt level < 1):
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr tilt-level=100 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
The property "normalize-translation" (true by default) lets you switch the translation normalization ON and OFF. When translation normalization is true the minimum and maximum translation values are mapped to -1 and 1. On the other hand, when it is set to false, the pan and tilt levels reflect pixels on the input image.
Turn off translation normalization:
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr normalize-translation=false ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
The property "output-reference" (true by default) lets you change the coordinate system used as reference for translations. This is specially useful after performing a rotation. If you want to move over the input image axis, it must be changed to false.
Set input coordinate system as reference for translations:
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr output-reference=false ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
To rotate the input modify the "rotate-level" property (degrees). You can also perform rotation relative to the current angle with "rotate-delta":
Rotate counter-clockwise (rotate level < 0):
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr rotate-level=-100 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Rotate clockwise (rotate level > 0):
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr rotate-level=100 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
The element supports input and output of any resolution and aspect ratio
Smaller input image, different aspect ratio:
IN_CAPS='video/x-raw,format=RGBA,width=1024,height=768,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Bigger input image, different aspect ratio:
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=1280,height=1024,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
You can use ranges for input and output caps or leave them unspecified
Resolution range:
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' OUT_CAPS='video/x-raw,format=RGBA,width=[480,1280],height=[680,1024],framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! capsfilter caps="$OUT_CAPS" ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Unspecified caps:
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1' gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! fpsdisplaysink silent=0 video-sink=fakesink -vvv
Performance
Performance measured by using:
# Average Behaviour gst-launch-1.0 qtiqmmfsrc ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! qtivtransform ! queue ! ptzr name=ptzr0 zoom-level=3 tilt-level=0.5 pan-level=0.5 rotate-level=30 ! perf print-cpu-load=1 ! queue ! fakesink # Limit Performance gst-launch-1.0 videotestsrc num-buffers=1 ! imagefreeze ! "video/x-raw,format=RGBA,width=1280,height=720" ! queue ! ptzr name=ptzr0 zoom-level=3 tilt-level=0.5 pan-level=0.5 rotate-level=30 ! perf print-cpu-load=1 ! queue ! fakesink
Performance using the Dragonwing 9075 EVK
| Resolution | Average Behaviour | Limit Performance | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| RAM(%) | GPU(%) | FPS | Mean FPS | CPU(%) | RAM(%) | GPU(%) | FPS | Mean FPS | CPU(%) | |
| 1280x720 | 0.3 | 1.71 | 29.756 | 29.949 | 17 | 0.1 | 3.99 | 140.828 | 140.942 | 14 |
| 1920x1080 | 0.3 | 3.65 | 29.982 | 29.980 | 19 | 0.2 | 7.30 | 111.283 | 114.638 | 17 |
| 3840x2160 | 0.6 | 13.72 | 29.998 | 30.047 | 20 | 0.5 | 14.18 | 61.915 | 58.278 | 16 |
The CPU consumption might be lower depending on the framerate and camera connection.