RidgeRun Spherical Video PTZ (Pan-Tilt-Zoom)
Overview of Spherical Video PTZ
Spherical Video PTZ (Pan-Tilt-Zoom) is a technology that allows users to dynamically adjust the viewing direction within a 360° video. This enables real-time navigation, providing an immersive experience that lets users explore a scene from different angles as if they were physically present.
Common applications of Spherical Video PTZ include:
- Sports and entertainment
- Live event viewing
- Real-time surveillance
- Vehicle surround monitoring
- Robot teleoperation
For spherical videos to be properly displayed, an equirectangular (2D spherical) image must be mapped to a rectilinear projection. Simply cropping the input results in distorted or warped images.
Spherical Video PTZ solves this simplifying this process by:
- Converting equirectangular images into rectilinear projections.
- Providing real-time pan (horizontal), tilt (vertical), and zoom controls.
- Utilizing NVIDIA Jetson and GStreamer for optimized processing.
These capabilities make it ideal for embedded video applications requiring seamless navigation through 360° footage.
Examples
This example demonstrates how to apply an automatic pan effect to a video stream and output the result as a new stream with the applied motion. To run this example, ensure that GSTD is installed on your system.
The example use memory type NVMM and are tested in performance mode using jetson_clocks.sh on NVIDIA Jetson platforms.
Resolutions and Definitions:
- HD: 1920×1080 (WIDTH=1920, HEIGHT=1080)
- 4K: 3840×2160 (WIDTH=1920, HEIGHT=1080)
- Source format: INPUT_# refers to the input video files
- Sink format: FILESINK is the name of the output file
You can find the example in the following script.
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <path_to_image>"
exit 1
fi
src_path="$1"
counter=0
loops=0
duration=10 # Video duration in seconds
frame_interval=0.009 # Time between frames in seconds
W=1920 #width
H=1080 #height
total_frames=$(echo "scale=0; $duration / $frame_interval" | bc)
new_counter=0
gstd-client pipeline_create p1 "filesrc location=${src_path} ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw(memory:NVMM),format=RGBA,width=$W,height=$H ! rrpanoramaptz name=ptz ! perf ! nvvidconv ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=panorama.mp4"
gstd-client pipeline_play p1
while [ $loops -lt $total_frames ] && [ $counter -lt 510 ]; do
((counter++))
if [ $counter -ge 330 ]; then
new_counter=$((counter - 330))
gstd-client element_set p1 ptz pan ${new_counter}
else
gstd-client element_set p1 ptz tilt ${counter}
fi
((loops++))
sleep $frame_interval
done
gstd-client pipeline_stop p1
gstd-client pipeline_delete p1
Make sure to convert it as executable.
sudo chmod +x test.sh
Then start GSTD as follows.
gstd &
Then execute the script.
./test.sh
Thor performance
For performance the pipeline used is the following:
gst-launch-1.0 filesrc location=360-s0.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! "video/x-raw(memory:NVMM),width=$WIDTH,height=$HEIGHT" ! rrpanoramaptz ! perf ! queue ! fakesink -v
| Resolution | CPU (%) | GPU (%) | FPS |
|---|---|---|---|
| HD | 1.75841 | 5.19 | 395.863 |
| 4K | 2.47011 | 8.40 | 179.142 |
Getting Started
To know more about the extension, please refer to the RidgeRun Spherical Video PTZ wiki page.
How to Purchase
For direct inquiries, please refer to the contact information available on our Contact page. Alternatively, you may complete and submit the form provided at the same link. We will respond to your request at our earliest opportunity.
Links to RidgeRun Resources and RidgeRun Artificial Intelligence Solutions can be found in the footer below.