GStreamer Motion Detection Element

From RidgeRun Developer Wiki



Previous: GStreamer_Plugins Index Next: GStreamer Plugins/Noise Reduction







The GStreamer element is called "rrmotiondetection". This element performs the motion detection stage, described in the Overview section. This element receives as input a video in RGBA or GRAY8 format and outputs a bitmask.

Main Properties

  • Motion: With this property you can choose the algorithm type to use.The default is “0”. The Possible options are:
(0): mog  - Background Subtractor MOG.
(1): mog2  - Background Subtractor MOG2.
  • Roi: With this property you can choose the region of interest and perform the motion detection only to the objects that are inside this region. By default the whole frame is taken into account. Only normalized positive values are accepted and they should be inside the image. The expected format for the ROI is x1, x2, y1, y2 where x1,y1 are the coordinates of the top left corner of the ROI and x2,y2 are the coordinates of the bottom right corner. For example;
... ! rrmotiondetection roi=“<<(float)0,(float)0.5,(float)0,(float)0.5>>” ! ...
  • Sample-frequency: Specifies the sample frequency of the video. This means that the element will only perform the motion detection every n-frames, where “n” is the sample frequency. For example if you use a value of “2”, you will see one frame processed each two frames.

Capabilities

This section overviews the Motion Detection input and output capabilities.

Below is the full output of the gst-inspect-1.0 command:

Factory Details:
  Rank                     none (0)
  Long-name                GstCUDA OpenCV Motion Detection
  Klass                    Filter
  Description              Example implementation of a motion detection algorithm using GstCUDA and OpenCV
  Author                   Melissa Montero <melissa.montero@ridgerun.com>, Greivin Brenes <greivin.brenes@ridgerun.com>

Plugin Details:
  Name                     rrmotiondetection
  Description              Motion detection components based on OpenCV
  Filename                 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstrrmotiondetection.so
  Version                  0.1.1
  License                  Proprietary
  Source module            motion-detection
  Binary package           motion-detection
  Origin URL               www.ridgerun.com

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseTransform
                         +----GstCudaBaseFilter
                               +----GstRrMotionDetection

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: GRAY8
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
  
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: { (string)RGBA, (string)GRAY8 }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw(memory:NVMM)
                 format: { (string)RGBA }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "rrmotiondetection0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  qos                 : Handle Quality-of-Service events
                        flags: readable, writable
                        Boolean. Default: false
  motion              : Type of motion to create
                        flags: readable, writable
                        Enum "Motion" Default: 0, "mog"
                           (0): mog              - Background Subtractor MOG
                           (1): mog2             - Background Subtractor MOG2
  roi                 : Region of Interest(ROI. Usage: <<(float)x1,(float)x2,(float)y1,(float)y2>>
                        flags: readable, writable
                        GstValueArray of GValues of type "GstValueArray"
  sample-frequency    : Specify the sample frequency
                        flags: readable, writable
                        Integer. Range: -2147483648 - 2147483647 Default: 1 


Previous: GStreamer_Plugins Index Next: GStreamer Plugins/Noise Reduction