GithubHelp home page GithubHelp logo

pisurvl's Introduction

Surveillance system based on Raspberry Pi.

Pisurvl is a surveillance solution with motion detection and alert notifications. This repository contains the server part of the solution. It is implemented in Python and it uses OpenCV to access the camera of the Raspberry Pi. Despite being implemented on top of a Raspberry Pi, the solution should work on any system having a camera that is supported by OpenCV.

Installation

Installing OpenCV

Currently there is no easy way to install OpenCV 3 on Linux. The following commands install all the necessary dependencies to build OpenCV 3:

sudo apt install build-essential cmake git pkg-config
sudo apt install libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt install libatlas-base-dev gfortran liblapacke-dev
sudo apt install python3 python3-dev python3-setuptools
sudo easy_install3 pip

The following command installs the latest version of Numpy. The installation may take a while to complete.

sudo pip3 install numpy

The following commands download and compile OpenCV 3:

mkdir build-opencv && cd build-opencv
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib && git checkout 3.2.0 && cd ..
cd opencv && git checkout 3.2.0
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release \
  -D CMAKE_INSTALL_PREFIX=/usr/local \
  -D OPENCV_EXTRA_MODULES_PATH=`pwd`/../../opencv_contrib/modules \
  ..
make -j4

Then install OpenCV:

sudo make install

Installing PiSurvl

sudo pip3 install --upgrade pisurvl
git clone https://github.com/betabandido/pisurvl.git
sudo cp pisurvl/init/pisurvl.service /etc/systemd/system
sudo systemctl enable pisurvl.service

Configuring PiSurvl

Create a settings file based on the provided template:

mkdir -p ~/.pisurvl
cp pisurvl/template-settings.yaml ~/.pisurvl/settings.yaml

Fill in the fields from and to in the notifications section.

Use Google API Manager to generate some client credentials and download the client_secrets.json file. Then move the file into the PiSurvl configuration folder:

mv client_secrets.json ~/.pisurvl

Execute pisurvl-setup --noauth_local_webserver and follow the instructions on the screen to authorize PiSurvl to access Google Drive.

Configuring Raspberry Pi

Use raspi-config to enable the camera interface. Then, after rebooting, load the Video4Linux driver by running:

sudo modprobe bcm2835-v4l2

Add this module to /etc/modules to automatically load the module whenever the Raspberry Pi boots.

Running PiSurvl

Use systemctl to start the service:

sudo systemctl start pisurvl.service

Development

To upload a new release to PyPI follow the next steps:

  1. Bump version in setup.py
  2. Run python3 setup.py sdist upload

pisurvl's People

Contributors

betabandido avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

pisurvl's Issues

File not found error

The following exception was thrown while trying to fetch a request.

Starting PiSurvl
Traceback (most recent call last):
  File "/usr/local/bin/pisurvl-server", line 9, in <module>
    load_entry_point('pisurvl==0.0.8', 'console_scripts', 'pisurvl-server')()
  File "/usr/local/lib/python3.4/dist-packages/pisurvl/main.py", line 20, in main
    Application().start()
  File "/usr/local/lib/python3.4/dist-packages/pisurvl/app.py", line 39, in start
    request = self._cmd_listener.fetch_request()
  File "/usr/local/lib/python3.4/dist-packages/pisurvl/messaging/command_listener.py", line 38, in fetch_request
    drive_manager.delete_file(file_id)
  File "/usr/local/lib/python3.4/dist-packages/pisurvl/google/drive.py", line 136, in delete_file
    self.service.files().delete(fileId=file_id).execute()
  File "/usr/local/lib/python3.4/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/googleapiclient/http.py", line 840, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/drive/v3/files/0B7kZ7Yk2CNtyZ1hOZTJleUNzRj
g? returned "File not found: 0B7kZ7Yk2CNtyZ1hOZTJleUNzRjg.">

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.