2014年2月19日水曜日

raspberry pi に webカメラを繋いでみる

今日はrasberry piにwebカメラを繋いでみる

つなぐカメラは普段Skype用につけている
ELECOM UCAM-DLE300T

とりあえず指して認識しているか確認
pi@raspberrypi ~ $ lsusb







ちゃんと認識しているようです。

webでググると監視カメラとして使うためのMotionというソフトウェアがリポジトリにあるようなのでインストール

pi@raspberrypi ~ $ sudo aptitude install motion

インストールしたら動かすための
設定ファイルを編集

pi@raspberrypi ~ $ sudo vi /etc/motion/motion.conf

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

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

pi@raspberrypi ~ $ sudo vi /etc/default/motion
# set to 'yes' to enable the motion daemon
start_motion_daemon=no
→start_motion_daemon=yes

これで準備完了。
起動
pi@raspberrypi ~ $ sudo service motion start

さて、Webブラウザから見えるらしいので、やってみる
http://(raspberry piのIP):8081/

あれあれ、何も映らない・・・・。

・・・ぐぐってみる・・・

どうやら動画の形式がmotion JPEGで、
chromeでURLじか指定してもは見れないようです。

しかたがないので下のように
htmlファイルを作成してその中のimgタグで指定

picamera.html
---------------------------------
<html>
<body>
<img src="http://raspberrypi.local:8081">
</body>
</html>

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

見れました!!






0 件のコメント:

コメントを投稿