NVIDIA VPI GStreamer Plug-in - Examples - Gaussian Filter

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: Examples Index Next: Examples/Undistort





Introduction

The vpigaussianfilter element applies the Gaussian Filter algorithm from the NVIDIA VPI library to a video stream.

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"

  • size-x

Gaussian kernel size in the X direction. Must be between 0 and 11, and odd. If it is 0, sigma-x will be used to compute its value using the formula [math]\displaystyle{ size = max\{ 3,2*\lceil 3 \sigma \rceil -1 \} }[/math]. In this case, sigma is limited to 2.
Type: Integer
Range: 0 - 11
Flags: readable, writable
Default: 7

  • size-y

Gaussian kernel size in the Y direction. Must be between 0 and 11, and odd. If it is 0, sigma-y will be used to compute its value using the formula [math]\displaystyle{ size = max\{ 3,2*\lceil 3 \sigma \rceil -1 \} }[/math]. In this case, sigma is limited to 2.
Type: Integer
Range: 0 - 11
Flags: readable, writable
Default: 7

  • sigma-x

Standard deviation of the Gaussian kernel in the X direction. If it is 0, size-x will be used to compute its value using the formula [math]\displaystyle{ 0.3 * ((size - 1) * 0.5 - 1) + 0.8 }[/math].
Type: Double
Range: 0 - 1,797693e+308
Flags: readable, writable
Default: 1.7

  • sigma-y

Standard deviation of the Gaussian kernel in the Y direction. If it is 0, size-y will be used to compute its value using the formula [math]\displaystyle{ 0.3 * ((size - 1) * 0.5 - 1) + 0.8 }[/math].
Type: Double
Range: 0 - 1,797693e+308
Flags: readable, writable
Default: 1.7

  • 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"

Example

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

For a Gaussian filter given by kernel size of 3 in the X direction and 7 in the Y direction, with a sigma value of 0.9 in both directions, and a boundary condition of clamp you may use:

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! 'video/x-raw,format=GRAY8' ! vpiupload ! vpigaussianfilter size-x=7 size-y=7 sigma-x=0.9 sigma-y=0.9 ! vpidownload ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvoverlaysink

Demo

Here is an example of this element in action:

Error creating thumbnail: Unable to save thumbnail to destination


Previous: Examples Index Next: Examples/Undistort