Make a surveillance camera from your raspberry pi!

Overview

rpi-surveillance

Make a surveillance camera from your Raspberry Pi 4!

The surveillance is built as following: the camera records 10 seconds video and if a motion was detected - sends the video to telegram channel.

The timestamp is printed on videos, so it is better to set the correct time on your Raspberry Pi.

The motion detection works in the following way: the camera’s H.264 encoder calculates motion vector estimates while generating compressed video. Using these vectors we threshold them by --magnitude-th argument. If more than --vectors-quorum vectors thresholded - mark current frame as containing motion. If there are more than --detection-frames consecutive frames with motion - motion detected.

Tested on Raspberry Pi 4 (4 RAM) + NoIR Camera V2.

Installation

Install package

Install Python 3 requirements:

pip3 install --user -r requirements.txt

Install provided .deb package:

sudo dpkg -i <path/to/downloaded/rpi-surveillance.deb>
sudo apt install -f

Note: the installation supposes that you already enabled camera module on your Raspberry Pi.

Create telegram bot and chat

  1. Write to @BotFather in telegram and create a bot:
/start
/newbot
<name of your bot>
<username of your bot>_bot

You will get the TOKEN. Save it for future use.

  1. Create a private channel where you will receive video sequences with motion.
  2. Add created bot to the channel (rerquires only "post messages" permission).
  3. Send message test to the channel.
  4. Run /usr/lib/rpi-surveillance/get_channel_id to get the CHANNEL_ID. Save it for future use.

Usage

To launch surveillance just run rpi-surveillance with your TOKEN and CHANNEL_ID, for example:

rpi-surveillance --token 1259140266:WAaqkMycra87ECzRZwa6Z_8T9KB4N-8OPI --channel-id -1003209177928

You can set various parameters of the surveillance:

usage: rpi-surveillance [-h] [--config CONFIG] --token TOKEN --channel-id
                        CHANNEL_ID [--temp-dir TEMP_DIR] [--log-file LOG_FILE]
                        [--resolution {640x480,1280x720,1920x1080}]
                        [--fps {25,30,60}] [--rotation {0,90,180,270}]
                        [--duration DURATION] [--magnitude-th MAGNITUDE_TH]
                        [--vectors-quorum VECTORS_QUORUM]
                        [--detection-frames DETECTION_FRAMES]

optional arguments:
  -h, --help            show this help message and exit
  --config CONFIG       Path to config file.
  --token TOKEN         Token for your telegram bot.
  --channel-id CHANNEL_ID
                        Telegram channel ID. If you don't have it please, send
                        a message to your channel and run /usr/lib/rpi-
                        surveillance/get_channel_id with your token.
  --temp-dir TEMP_DIR   Path to temporary directory for video saving before
                        sending to channel. Don't change it if you don't know
                        what you're doing.
  --log-file LOG_FILE   Path to log file for logging.
  --resolution {640x480,1280x720,1920x1080}
                        Camera resolution. Default - 640x480.
  --fps {25,30,60}      Frames per second. Default - 25.
  --rotation {0,90,180,270}
                        Frame rotation. Default - 0.
  --duration DURATION   Duration of videos in seconds. Default - 10.
  --magnitude-th MAGNITUDE_TH
                        Magnitude threshold for motion detection (lower - more
                        sensitive). Defaults: for 640x480 - 15, for 1280x720 -
                        40, for 1920x1080 - 65.
  --vectors-quorum VECTORS_QUORUM
                        Vectors quorum for motion detection (lower - more
                        sensitive). Defaults: for 640x480 - 10, for 1280x720 -
                        20, for 1920x1080 - 40.
  --detection-frames DETECTION_FRAMES
                        The number of consecutive frames with detected motion
                        to send an alert.

Build

Build was done using dpkg-buildpackage.

You might also like...
Make your master artistic punk avatar through machine learning world famous paintings.
Make your master artistic punk avatar through machine learning world famous paintings.

Master-art-punk Make your master artistic punk avatar through machine learning world famous paintings. 通过机器学习世界名画制作属于你的大师级艺术朋克头像 Nowadays, NFT is beco

Python-experiments - A Repository which contains python scripts to automate things and make your life easier with python
Python-experiments - A Repository which contains python scripts to automate things and make your life easier with python

Python Experiments A Repository which contains python scripts to automate things

A very lightweight monitoring system for Raspberry Pi clusters running Kubernetes.
A very lightweight monitoring system for Raspberry Pi clusters running Kubernetes.

OMNI A very lightweight monitoring system for Raspberry Pi clusters running Kubernetes. Why? When I finished my Kubernetes cluster using a few Raspber

Run object detection model on the Raspberry Pi

Using TensorFlow Lite with Python is great for embedded devices based on Linux, such as Raspberry Pi.

 Tutorial to set up TensorFlow Object Detection API on the Raspberry Pi
Tutorial to set up TensorFlow Object Detection API on the Raspberry Pi

A tutorial showing how to set up TensorFlow's Object Detection API on the Raspberry Pi

An air quality monitoring service with a Raspberry Pi and a SDS011 sensor.

Raspberry Pi Air Quality Monitor A simple air quality monitoring service for the Raspberry Pi. Installation Clone the repository and run the following

A tutorial showing how to train, convert, and run TensorFlow Lite object detection models on Android devices, the Raspberry Pi, and more!
A tutorial showing how to train, convert, and run TensorFlow Lite object detection models on Android devices, the Raspberry Pi, and more!

A tutorial showing how to train, convert, and run TensorFlow Lite object detection models on Android devices, the Raspberry Pi, and more!

🍅🍅🍅YOLOv5-Lite: lighter, faster and easier to deploy. Evolved from yolov5 and the size of model is only 1.7M (int8) and 3.3M (fp16). It can reach 10+ FPS on the Raspberry Pi 4B when the input size is 320×320~
🍅🍅🍅YOLOv5-Lite: lighter, faster and easier to deploy. Evolved from yolov5 and the size of model is only 1.7M (int8) and 3.3M (fp16). It can reach 10+ FPS on the Raspberry Pi 4B when the input size is 320×320~

YOLOv5-Lite:lighter, faster and easier to deploy Perform a series of ablation experiments on yolov5 to make it lighter (smaller Flops, lower memory, a

A facial recognition doorbell system using a Raspberry Pi

Facial Recognition Doorbell This project expands on the person-detecting doorbell system to allow it to identify faces, and announce names accordingly

Releases(v2.2.2)
Owner
Vladyslav
Machine learning and computer vision developer.
Vladyslav
Real-world Anomaly Detection in Surveillance Videos- pytorch Re-implementation

Real world Anomaly Detection in Surveillance Videos : Pytorch RE-Implementation This repository is a re-implementation of "Real-world Anomaly Detectio

seominseok 62 Dec 8, 2022
Source codes of CenterTrack++ in 2021 ICME Workshop on Big Surveillance Data Processing and Analysis

MOT Tracked object bounding box association (CenterTrack++) New association method based on CenterTrack. Two new branches (Tracked Size and IOU) are a

null 36 Oct 4, 2022
MohammadReza Sharifi 27 Dec 13, 2022
Camera-caps - Examine the camera capabilities for V4l2 cameras

camera-caps This is a graphical user interface over the v4l2-ctl command line to

Jetsonhacks 25 Dec 26, 2022
Make a Turtlebot3 follow a figure 8 trajectory and create a robot arm and make it follow a trajectory

HW2 - ME 495 Overview Part 1: Makes the robot move in a figure 8 shape. The robot starts moving when launched on a real turtlebot3 and can be paused a

Devesh Bhura 0 Oct 21, 2022
CVPRW 2021: How to calibrate your event camera

E2Calib: How to Calibrate Your Event Camera This repository contains code that implements video reconstruction from event data for calibration as desc

Robotics and Perception Group 104 Nov 16, 2022
Make your own game in a font!

Project structure. Included is a suite of tools to create font games. Tutorial: For a quick tutorial about how to make your own game go here For devel

Michael Mulet 125 Dec 4, 2022
Make your AirPlay devices as TTS speakers

Apple AirPlayer Home Assistant integration component, make your AirPlay devices as TTS speakers. Before Use 2021.6.X or earlier Apple Airplayer compon

George Zhao 117 Dec 15, 2022
Make Watson Assistant send messages to your Discord Server

Make Watson Assistant send messages to your Discord Server Prerequisites Sign up for an IBM Cloud account. Fill in the required information and press

null 1 Jan 10, 2022
A project to make Amazon Echo respond to sign language using your webcam

Making Alexa respond to Sign Language using Tensorflow.js Try the live demo Read the Blog Post on Tensorflow's Blog Coming Soon Watch the video This p

Abhishek Singh 444 Jan 3, 2023