2015年10月16日 星期五

Raspberry Pi: Using a standard USB webcam

since: 2015/10/16
update: 2015/10/16

reference:
1. Using a standard USB webcam
2. Raspberry Pi 安裝 Webcam 和 Motion Webcam Server
3. Raspberry Pi 筆記(十九): Webcam 拍照與瀏覽串流媒體

A. 單張照片拍照功能:
     1. $ lsusb
...
Bus 001 Device 004: ID 1871:0341 Aveo Technology Corp.
...

     2. $ ls /dev/video0
/dev/video0

     3. 安裝 fswebcam
         $ sudo apt-get update
         $ sudo apt-get upgrade
         $ sudo apt-get install fswebcam

     4. 抓圖測試:
         $ fswebcam -d /dev/video0 test.jpg
         (or $ fswebcam image.jpg)

--------------------------------------------------------------------------------------------

B. 移動偵測拍照功能:

     1. 安裝 motion
         $ sudo apt-get install motion
         $ mkdir /tmp/motion
         $ sudo chmod -R 777 /tmp/motion
         $ sudo chmod -R 777 /etc/motion/motion.conf

     2. $ sudo nano /etc/default/motion
# set to 'yes' to enable the motion daemon
#start_motion_daemon=no

start_motion_daemon=yes

     3. $ sudo nano /etc/motion/motion.conf
....

# Start in daemon (background) mode and release terminal (default: off)
#daemon off

daemon on

# Image width (pixels). Valid range: Camera dependent, default: 352
# width 320

width 640

# Image height (pixels). Valid range: Camera dependent, default: 288
# height 240

height 480

# Maximum number of frames to be captured per second.
# Valid range: 2-100. Default: 100 (almost no limit).
#framerate 2

framerate 60

# The mini-http server listens to this port for requests (default: 0 = disabled)
webcam_port 8081

# Quality of the jpeg (in percent) images produced (default: 50)
# webcam_quality 50

webcam_quality 100

# Restrict webcam connections to localhost only (default: on)
webcam_localhost on

# TCP/IP port for the http server to listen on (default: 0 = disabled)
control_port 8080

# Restrict control connections to localhost only (default: on)
control_localhost on

....

     4. $ sudo service motion restart

     5. 在 pi 上, 測試:
         a. $ startx
         b. 開啟瀏覽器輸入: http://127.0.0.1:8081/

--------------------------------------------------------------------------------------------

C. 簡易 Pi 視窗桌面相機:
     1. $ sudo apt-get install camorama

     2. $ startx

     3. 測試: Graphics > Camorama Webcam Viewer

    備註:
    1. 亦可在進入視窗模式後, 利用終端機啟動 ($ camorama --help)

    2. 調整存擋位置:
         Edit > Preferences > Local Capture > Browse... > OK

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。