OpenCV Tracker Element for Object Tracking
What is it?
A tracker element based on OpenCV's long-term tracker algorithm implementation from here.
Sample pipeline: gst-launch-1.0 filesrc location=/home/vivek/Desktop/GStreamer_plugin/t.mp4 ! decodebin ! videoconvert ! cvtracker object-initial-x=175 object-initial-y=40 object-initial-width=300 object-initial-height=150 algorithm=1 ! videoconvert ! xvimagesink
Input/Parameters
The tracker
element takes input: a bounding box
to initiate the tracker with the object to be tracked and algorithm
for tracking. The first frame passing through the tracker element is taken as the initialization frame and the tracker element tracks the object for the subsequent frames.
Properties:
object-initial-x: bounding box's x co-ordinate
object-initial-y: bounding box's y co-ordinate
object-initial-width: bounding box's width
object-initial-height: bounding box's height
algorithm: choose from 7 different tracking algorithms [0-6]
Output
Writes the tracked object's coordinates (x, y, width and height) to the GstVideoRegionOfInterest metadata to the buffer for each frame. Also draws a rectangle around the object on the video stream.
Uses
This element can be used to track any object using OpenCV's tracking implementation. The ROI stored in the metadata can be used to attach "silly hats" or filters to the area.
OPENCV PATCH FIX: While compiling gst-plugins-bad
from the master branch, it left out the bgsegm.hpp
header and the patch here fixes that.