NVIDIA VPI GStreamer Plug-in - Examples - Separable Convolution

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: Examples/Convolution Index Next: Performance





Introduction to Separable Convolution

The vpiseparableconvolution element applies the Separable Convolution algorithm from the NVIDIA VPI library to a video stream. In order to use this algorithm, you must provide the kernel row and kernel column to be applied.

Element properties

  • backend

Backend to use to execute VPI algorithms. Available options:

cpu: CPU backend
cuda: CUDA backend
pva: PVA backend (Xavier only)
vic: VIC backend

Flags: readable, writable
Default: "cuda"

  • kernel-row

Horizontal convolution kernel to be applied with a minimum size of 1 and maximum of 11. Usage example:

<1.0, 0.0, -1.0>

Type: GstValueArray of GValues
Flags: readable, writable
Default: <1>

  • kernel-col

Vertical convolution kernel to be applied with a minimum size of 1 and maximum of 11. Usage example:

<1.0, 0.0, -1.0>

Type: GstValueArray of GValues
Flags: readable, writable
Default: <1>

  • boundary

How pixel values outside of the image domain should be treated. Available options:

zero: All pixels outside the image are considered 0.
clamp: Border pixels are repeated indefinitely.

Flags: readable, writable
Default: "zero"

NVIDIA VPI GStreamer Plug-in Example for Separable Convolution

The following example pipe will help you apply separable convolution to the input video stream from your camera. You may modify the properties values according to the information above.

For a separable convolution given by a 7x7 Sobel filter, and a boundary condition of zero you may use:

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! 'video/x-raw,format=GRAY8' ! vpiupload ! vpiseparableconvolution kernel-row="<-1.0, -5.0, -6.0, 0.0, 6.0, 5.0, 1.0>" kernel-col="<0.015625, 0.09374, 0.234375, 0.3125, 0.09374, 0.015625>" ! vpidownload ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvoverlaysink

Another example pipeline for a video test source could be the following:

gst-launch-1.0 videotestsrc pattern=spokes ! 'video/x-raw,format=GRAY8' ! vpiupload ! vpiseparableconvolution kernel-row="<-1.0, -5.0, -6.0, 0.0, 6.0, 5.0, 1.0>" kernel-col="<0.015625, 0.09374, 0.234375, 0.3125, 0.09374, 0.015625>" ! vpidownload ! nvvidconv ! "video/x-raw(memory:NVMM),format=I420" ! nvoverlaysink


Previous: Examples/Convolution Index Next: Performance