Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

motion detection and alerts

Project description


This program is a security monitoring program that uses video to detect motion, that records motion video, can express speech alerts, can express alarms and attempts to communicate alerts as configured.

setup (Ubuntu 16.04 LTS)

Python 2 and OpenCV 2 are required. Specifically, this program has been tested with OpenCV and

Install dependencies.

sudo apt update
sudo apt install   \
    libasound-dev  \
    python-dev     \
    python-pyaudio \

Install OpenCV 2 using the following procedure, which was defined here.

sudo apt install                     \
    build-essential                  \
    cmake                            \
    libgtk2.0-dev                    \
    pkg-config                       \
    python-dev                       \
    checkinstall                     \
    libavcodec-dev                   \
    libavcodec-dev                   \
    libavformat-dev                  \
    libavformat-dev                  \
    libdc1394-22-dev                 \
    libgstreamer0.10-dev             \
    libgtk2.0-dev                    \
    libjasper-dev                    \
    libjasper-dev                    \
    libjpeg-dev                      \
    libjpeg-dev                      \
    libmp3lame-dev                   \
    libopencore-amrnb-dev            \
    libopencore-amrwb-dev            \
    libopencv-dev                    \
    libpng12-dev                     \
    libqt4-dev                       \
    libswscale-dev                   \
    libswscale-dev                   \
    libtbb-dev                       \
    libtheora-dev                    \
    libtiff5-dev                     \
    libv4l-dev                       \
    libvorbis-dev                    \
    libxine2                         \
    libxvidcore-dev                  \
    python-dev                       \
    python-numpy                     \
    v4l-utils                        \
    x264                             \
wget -O
cd opencv-
mkdir release
cd release
cmake                                \
    -G "Unix Makefiles"              \
    CMAKE_C_COMPILER=/usr/bin/gcc    \
    -DWITH_TBB=ON                    \
    -DWITH_V4L=ON                    \
    -DINSTALL_C_EXAMPLES=ON          \
    -DBUILD_EXAMPLES=ON              \
    -DWITH_QT=ON                     \
    -DWITH_OPENGL=ON                 \
    -DBUILD_FAT_JAVA_LIB=ON          \
    -DINSTALL_TESTS=ON               \
    -DENABLE_FAST_MATH=ON            \
    -DWITH_IMAGEIO=ON                \
    -DBUILD_SHARED_LIBS=OFF          \
make all -j"$(nproc)"
sudo make install
cd ../../
rm -rf ./opencv-
sudo apt install python-opencv
echo -e "OpenCV version:"
pkg-config --modversion opencv

Install sentinel.

sudo pip install python_sentinel

Manually create an account on a Matrix homeserver. Add the credentials to the scalar configuration file, as described here.


sentinel --help
sentinel --display_windows=false --launch_delay=120 --record_duration=15 --message=true

In case of connections problems or other problems that might cause a crash, It may be sensible to have sentinel restart in the case of a crash. This could be done in a way like the following, perhaps with the function described added to .bashrc, and perhaps saving to Nextcloud for remote recording (in additional to the remote recording via messaging):

    #cd ~/Nextcloud
    #mkdir sentinel
    #cd sentinel
    while true; do
        sentinel --display_windows=false --launch_delay=120 --record_duration=15 --message=true
        sleep 5



Migration from OpenCV 2 to OpenCV 3 or 4 is under consideration.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python_sentinel, version 2019.5.28.1348
Filename, size File type Python version Upload date Hashes
Filename, size python_sentinel-2019.5.28.1348.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page