Skip to content

About

A compact C++ application that captures a live color stream from an Intel RealSense camera, performs simple motion detection, and records video clips when motion is detected.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

RealSense Motion Detection

A compact C++ application that captures a live color stream from an Intel RealSense camera, performs simple motion detection, and records video clips when motion is detected.

Features

  • Real-time motion detection using frame differencing
  • Records video clips on motion and stops after 5 s of no motion
  • Splits recordings every 5 min to limit file size
  • Automatically manages disk space by deleting oldest files when free space is low
  • Optional work-hour exclusion (Mon–Fri, 09:00–17:00)

Prerequisites

  • Ubuntu or similar Linux distribution
  • Intel RealSense SDK 2.0 (librealsense2)
  • OpenCV 4.x

Install dependencies:

sudo apt update
sudo apt install build-essential libopencv-dev librealsense2-dev

Build

git clone <repo-url>
cd <repo-folder>
# Ensure pkg-config paths include librealsense2 and opencv4
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH

# Compile
g++ -std=c++11 motion_detect_stream.cpp -o motion_detect_stream \
    $(pkg-config --cflags opencv4 realsense2) \
    $(pkg-config --libs   opencv4 realsense2)

Usage

# Basic mode:
./motion_detect_stream

# Disable recording during work hours (Mon–Fri, 09:00–17:00):
./motion_detect_stream --disable-work-hours

Recorded videos are saved to surveillance_videos/ as motion_YYYYMMDD_HHMMSS.avi.

About

A compact C++ application that captures a live color stream from an Intel RealSense camera, performs simple motion detection, and records video clips when motion is detected.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages