Coder Social home page Coder Social logo

camp's Introduction

camp

Another Raspberry Pi camera webserver.

What it does

Hosts a website where you can view your webcam in real time.

Why I wrote it

There are a lot of tutorials out there on how to turn your pi into a webcam server. Most of them involve installing motion, which works great in many use cases. However, I wanted something simpler. Namely, I wanted:

  • Minimal configuration
  • Password protection
  • One-way streaming
  • Easily customizable webpage
  • Extensible server

camp does just this. Nothing else. This (hopefully) makes it the simplest and fastest option out there.

Installation

Camp uses tornado to create a web server. It can interact with the Pi camera with the aptly named picamera module, or it can use USB webcams with opencv and Pillow. The command below installs both sets of dependencies.

sudo apt-get install python-dev python-pip python-opencv libjpeg-dev
sudo pip install tornado Pillow picamera

Once the dependencies are installed on your pi, you can clone this repository and run the server.

git clone https://github.com/patrickfuller/camp.git
python camp/server.py

Navigate to http://your.r.pi.ip:8000 and check out your webcam.

####USB Camera

Use with python server.py --use-usb.

####Password

With the --require-login flag, camp will open a login page before allowing webcam access.

The default password is "raspberry". In order to change it, run this in your camp directory:

python -c "import hashlib; import getpass; print(hashlib.sha512(getpass.getpass())).hexdigest()" > password.txt

This will prompt you for a password, encrypt it, and save the result in password.txt.

Note that this level of password protection is basic - it's fine for keeping the occasional stranger out, but won't stand up to targeted hacking.

####Run on startup

It's nice to have your pi start camp whenever it turns on. Let's make that happen. Type sudo nano /etc/rc.local to open this file for editing, and add the line nohup python /home/pi/camp/server.py & before the last line. Note that you may need to change the path (/home/pi/camp/server.py) to point to the right file.

####Customization

The website consists of index.html, login.html, and style.css. These can be edited to change the look of camp.

If you want to add in extra functionality, edit client.js and server.py. The client should send a request to the server, which will then cause the server to do something.

If you want to add in extra camera features, opencv comes with a lot of useful computer vision algorithms. Check out its functionality before writing your own.

camp's People

Contributors

nick-hunter avatar patrickfuller avatar themcaffee avatar

Watchers

 avatar

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.