GstCUDA - Example - opencvfilter
![]() |
Contents
Introduction
The opencvfilter element exposes a series of image filters from the popular computer vision framework OpenCV. The following figure shows some of the available filters applied to the same image.
Element properties
- size
The size of the filter. Depending on the filter, it could either be the kernel size or the aperture size. Must be odd.
Type: Integer
Range: 1 - 2147483647
Flags: readable, writable
Default: 3
- filter
Type of the filter to create. Available options:
- box: Normalized box filter
- box-max: Maximum filter
- box-min: Minimum filter
- column-sum: Vertical 1D box filter
- deriv: General deriv filter
- gaussian: Gaussian filter
- laplacian: Laplacian filter
- linear: General linear filter
- morphology: Morphological filter
- row-sum: Horizontal 1D box filter
- scharr: Scharr filter
- separable: Separable linear filter
- sobel: Sobel filter
Flags: readable, writable
Default: "gaussian"
- dx
Derivative order in respect of X.
Type: Integer
Range: 0 - 2
Flags: readable, writable
Default: 0
- dy
Derivative order in respect of Y.
Type: Integer
Range: 0 - 2
Flags: readable, writable
Default: 0
- scale
Optional scale factor for the computed values.
Type: Integer
Range: 1 - 2147483647
Flags: readable, writable
Default: 1
- iterations
Number of times for the morphological operations to be applied.
Type: Integer
Range: 1 - 2147483647
Flags: readable, writable
Default: 1
- morph-op
Type of morphological operation. 0: Erode, 1: Dilate, 2: Open, 3: Close.
Type: Integer
Range: 0 - 3
Flags: readable, writable
Default: 0
Example
The following example pipe will help you apply a sobel edge detector filter to the input video stream from your camera. This pipe was tested on both, the Nvidia Jetson TX1 and TX2.
gst-launch-1.0 v4l2src ! nvvidconv ! opencvfilter filter=sobel dx=0 dy=1 size=1 ! queue ! nvvidconv ! autovideosink