Skip to main content

motion detection and alerts

Project description

sentinel

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 2.4.9.1 and 2.4.13.5.

Install dependencies.

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

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             \
    libgstreamer-plugins-base0.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                             \
    yasm
wget https://github.com/opencv/opencv/archive/2.4.13.5.zip -O opencv-2.4.13.5.zip
unzip opencv-2.4.13.5.zip
cd opencv-2.4.13.5
mkdir release
cd release
cmake                                \
    -G "Unix Makefiles"              \
    -DCMAKE_CXX_COMPILER=/usr/bin/g++\
    CMAKE_C_COMPILER=/usr/bin/gcc    \
    -DCMAKE_BUILD_TYPE=RELEASE       \
    -DCMAKE_INSTALL_PREFIX=/usr/local\
    -DWITH_TBB=ON                    \
    -DBUILD_NEW_PYTHON_SUPPORT=ON    \
    -DWITH_V4L=ON                    \
    -DINSTALL_C_EXAMPLES=ON          \
    -DINSTALL_PYTHON_EXAMPLES=ON     \
    -DBUILD_EXAMPLES=ON              \
    -DWITH_QT=ON                     \
    -DWITH_OPENGL=ON                 \
    -DBUILD_FAT_JAVA_LIB=ON          \
    -DINSTALL_TO_MANGLED_PATHS=ON    \
    -DINSTALL_CREATE_DISTRIB=ON      \
    -DINSTALL_TESTS=ON               \
    -DENABLE_FAST_MATH=ON            \
    -DWITH_IMAGEIO=ON                \
    -DBUILD_SHARED_LIBS=OFF          \
    -DWITH_GSTREAMER=ON ..
make all -j"$(nproc)"
sudo make install
cd ../../
rm -rf ./opencv-2.4.13.5
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.

usage

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):

run_sentinel(){
    #cd ~/Nextcloud
    #mkdir sentinel
    #cd sentinel
    while true; do
        sentinel --display_windows=false --launch_delay=120 --record_duration=15 --message=true
        sleep 5
    done
}

run_sentinel

future

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.

Source Distribution

python_sentinel-2019.5.28.1348.tar.gz (7.7 kB view details)

Uploaded Source

File details

Details for the file python_sentinel-2019.5.28.1348.tar.gz.

File metadata

File hashes

Hashes for python_sentinel-2019.5.28.1348.tar.gz
Algorithm Hash digest
SHA256 909b0393fbbfb283dff60122d6b189d9b39049c9a8f55333fa29db82165c6c12
MD5 5532c2a2a0041379eec512c1dd883e25
BLAKE2b-256 f070d8fe91ab8ed780ea0d4b79fbbe630061a80d51803ffd56f3535a92d2583e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page