camp:一个由Websocket提供动力的树莓派摄像头Web服务器

  • r6_233508
    了解作者
  • 1.1MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-14 02:58
    上传日期
营 另一个 Raspberry Pi 相机网络服务器。 它能做什么 托管一个网站,您可以在其中实时查看网络摄像头。 我为什么写 有很多关于如何将 pi 变成网络摄像头服务器的教程。 他们中的大多数都涉及安装 ,这在许多用例中都很好用。 但是,我想要更简单的东西。 也就是说,我想要: 最小配置 密码保护 单向流 易于定制的网页 可扩展服务器 营地就是这样做的。 没有其他的。 这(希望)使它成为最简单和最快的选择。 安装 Camp 使用来创建 Web 服务器。 它可以通过恰当命名的模块与交互,或者它可以使用带有和USB 网络摄像头。 下面的命令安装两组依赖项。 sudo apt-get install python-dev python-pip python-opencv libjpeg-dev sudo pip install tornado Pillow picamera 在 pi
camp-master.zip
  • camp-master
  • index.html
    1.6KB
  • favicon.ico
    1.1KB
  • img
  • login.png
    61.8KB
  • example.png
    981.5KB
  • logo.png
    79.5KB
  • server.py
    4.3KB
  • LICENSE
    1.1KB
  • login.html
    923B
  • README.md
    2.9KB
  • client.js
    934B
  • password.txt
    129B
  • .gitignore
    22B
  • style.css
    1019B
内容介绍
camp ==== Another Raspberry Pi camera webserver. ![](img/example.png) 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](http://www.lavrsen.dk/foswiki/bin/view/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](http://www.tornadoweb.org/en/stable/) to create a web server. It can interact with the [Pi camera](http://www.adafruit.com/products/1367) with the aptly named [picamera](http://picamera.readthedocs.org/en/release-1.7/) module, or it can use USB webcams with [opencv](http://opencv.org/) and [Pillow](http://pillow.readthedocs.org/en/latest/installation.html). 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 ![](img/login.png) 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.
评论
    相关推荐