Birds Eye View - Generic Pipelines

From RidgeRun Developer Wiki



⇦ GStreamer/GstBEV Plugin Home GStreamer/Jetson Pipelines ⇨




For testing the plugin you can also use the following examples for x86 for different situations. These pipelines are just a guide, you can combine and modify them to fit your needs.

Setting up Environment Variables

First, is important to create the calibration file using the calibration tool. For the following examples, we will use the Birds Eye View calibration file provided. Therefore, the examples will expect the input of 6 cameras and a resolution of 1280x720px, the number of cameras and resolution can be adjusted depending on the calibration file.

CALIBRATION_FILE=birds_eye_view.json
CAPS="video/x-raw,format=RGBA"

You'll notice that we deliberately don't specify the resolution in the caps, since it should be automatically picked up by the codecs.

Birds Eye View from images

For this example, we will use the sample images provided.

Saving a image

gst-launch-1.0 bev name=bev0 calibration-file=$CALIBRATION_FILE \
 filesrc location=samples/bev_6_cameras/cam_0.jpg ! jpegparse ! jpegdec ! videoconvert ! queue ! bev0.sink_0 \
 filesrc location=samples/bev_6_cameras/cam_1.jpg ! jpegparse ! jpegdec ! videoconvert ! queue ! bev0.sink_1 \
 filesrc location=samples/bev_6_cameras/cam_2.jpg ! jpegparse ! jpegdec ! videoconvert ! queue ! bev0.sink_2 \
 filesrc location=samples/bev_6_cameras/cam_5.jpg ! jpegparse ! jpegdec ! videoconvert ! queue ! bev0.sink_3 \
 filesrc location=samples/bev_6_cameras/cam_4.jpg ! jpegparse ! jpegdec ! videoconvert ! queue ! bev0.sink_4 \
 filesrc location=samples/bev_6_cameras/cam_3.jpg ! jpegparse ! jpegdec ! videoconvert ! queue ! bev0.sink_5 \
 bev0. ! queue ! videoconvert ! jpegenc ! filesink location=$OUTPUT

The expected output would be the following.

BEV result

Birds Eye view from UDP SRC

For this example the ports for each camera will start from 4000 to 4005.

Saving a mp4 file

gst-launch-1.0 -ve \
udpsrc port=4000 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_0 \
udpsrc port=4001 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_1 \
udpsrc port=4002 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_2 \
udpsrc port=4003 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_3 \
udpsrc port=4004 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_4 \
udpsrc port=4005 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_5 \
bev name=bev calibration-file=$CALIBRATION_FILE ! queue ! videoconvert ! x264enc ! h264parse ! mp4mux ! filesink location=$OUTPUT

Streaming via UDP+RTP

Set the HOST variable to the Receiver's IP

Sender

gst-launch-1.0 -v \
udpsrc port=4000 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_0 \
udpsrc port=4001 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_1 \
udpsrc port=4002 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_2 \
udpsrc port=4003 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_3 \
udpsrc port=4004 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_4 \
udpsrc port=4005 ! application/x-rtp ! rtph264depay ! queue ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! queue ! bev.sink_5 \
bev name=bev calibration-file=$CALIBRATION_FILE ! queue ! videoconvert ! x264enc ! rtph264pay config-interval=10  ! queue ! udpsink host=$HOST port=$PORT

Receiver

gst-launch-1.0 udpsrc port=$PORT ! 'application/x-rtp,media=(string)video,encoding-name=(string)H264' !  queue ! rtph264depay ! avdec_h264 ! videoconvert ! xvimagesink

Birds Eye view from mp4

Define the name of each mp4 file in the INPUT_ variables.

Displaying

gst-launch-1.0 bev name=bev0 calibration-file=$CALIBRATION_FILE \
 filesrc location=$INPUT_0 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! $CAPS ! bev0.sink_0 \
 filesrc location=$INPUT_1 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert !  $CAPS ! bev0.sink_1 \
 filesrc location=$INPUT_2 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert !  $CAPS ! bev0.sink_2 \
 filesrc location=$INPUT_3 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert !  $CAPS ! bev0.sink_3 \
 filesrc location=$INPUT_4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert !  $CAPS ! bev0.sink_4 \
 filesrc location=$INPUT_5 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert !  $CAPS ! bev0.sink_5 \
 bev0. !  queue ! videoconvert ! xvimagesink

Birds Eye View from cameras

First, define the device ID for each camera, for this example, each camera will follow the common id provided by USB cameras.

Displaying

# We need to define the desired resolution here since v4l2src can give us various image sizes.
CAPS="video/x-raw,width=1280,height=720,format=RGBA"

gst-launch-1.0 bev name=bev0 calibration-file=$CALIBRATION_FILE \
 v4l2src device=/dev/video0 ! videoconvert ! $CAPS ! bev0.sink_0 \
 v4l2src device=/dev/video2 ! videoconvert ! $CAPS ! bev0.sink_1 \
 v4l2src device=/dev/video4 ! videoconvert ! $CAPS ! bev0.sink_2 \
 v4l2src device=/dev/video6 ! videoconvert ! $CAPS ! bev0.sink_3 \
 v4l2src device=/dev/video8 ! videoconvert ! $CAPS ! bev0.sink_4 \
 v4l2src device=/dev/video10 ! videoconvert ! $CAPS ! bev0.sink_5 \
 bev0. !  queue ! videoconvert ! autovideosink



⇦ GStreamer/GstBEV Plugin Home GStreamer/Jetson Pipelines ⇨