GstMotionDetect on Jetson TK1: Difference between revisions

From RidgeRun Developer Wiki
Line 45: Line 45:
<pre>
<pre>
gst-inspect-0.10 motion
gst-inspect-0.10 motion
</pre
</pre>

Revision as of 21:03, 16 March 2018

Evaluating gst-motion-detect

This section shows the steps to use the evaluation version of RidgeRun's Motion Detect GStreamer plugin.

1. Copy the binary to the proper location in the TK1 board:

cp libgstmotion.so /usr/lib/arm-linux-gnueabihf/gstreamer-0.10/

2. Now check that the plugin is properly loaded by gstreamer:

gst-inspect-0.10 motion

This command should display the plugin information.

3. Finally execute the test pipeline. For this pipeline to work you will need a camera connected to the TK1 with support for 640x480@30fps, by default the pipeline uses /dev/video0.

gst-launch-0.10 v4l2src ! 'video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(fourcc)YUY2' ! ffmpegcolorspace ! 'video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(fourcc)NV12' ! motion window-x1=0 window-y1=0 window-x2=639 window-y2=479 sample-width=640 sample-height=480 bg-timeout=30 bg-frames=2 frames-offset=0 frames-to-motion=1 threshold=3 sensitivity=4 enable=true  ! 'video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(fourcc)NV12' ! ffmpegcolorspace ! 'video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(fourcc)YUY2' ! xvimagesink

This pipeline detects motion within a 640x480 window, you can play with the motion properties to change the area of detection. Also take into account that the ideal threshold and sensitivity of detection will depend on the camera used and the environment lighting conditions.

When the plugin detects motion you will see the following messages in the terminal:

******* SENDING START MOTION SIGNAL *******
******* SENDING STOP MOTION SIGNAL *******

Building gst-motion-detect

This section shows how to build gst-motion-detect-0.10 plugin for TK1. After obtaining the source code from RidgeRun, clone it in the TK1 board and run:

./autogen.sh
./configure --prefix /usr --libdir /usr/lib/arm-linux-gnueabihf/
make
sudo make install

NOte: In case that a visual feedback of the detected movement is desired, the debug option can be enabled running the configure step as follows:

./configure --prefix /usr --libdir /usr/lib/arm-linux-gnueabihf/ --enable-debug

After the install, you should be able to inspect the plugin as follows:

gst-inspect-0.10 motion