Contents
USBカメラの利用
USB デバイス一覧からも確認
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 056e:7009 Elecom Co., Ltd
Bus 001 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $
デバイスのリストからも確認
ソフトでカメラの確認
guvcview
guvcview
を使用してみました。pi@raspberrypi:~ $ sudo apt-get install guvcview
guvcview
を探して、起動してみてください。fswebcam
— Opening /dev/video0…
Trying source module v4l2…
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384×288 to 352×288.
— Capturing frame…
Captured frame in 0.00 seconds.
— Processing captured image…
Writing JPEG image to ‘image.jpg’.
pi@raspberrypi:~/Pictures $
公式内蔵カメラの利用
カメラを有効にする
「sudo raspi-config」を起動して、「Legacy Camera Enable/disble legacy camera support」を選択して、Enableしてください。
カメラの回転
カメラ回転の場合、次のコマンドでファイルに v4l2-ctl –set-ctrl=rotate=90 を/etc/rc.local に追加。
pi@raspberrypi:~ $ sudo vi /etc/rc.local
カメラの認識
コマンドの次の行に「supported=1 detected=1」と表示されたら、カメラが認識されていることになります。
pi@raspberrypi:~ $ vcgencmd get_camera
supported=1 detected=1
pi@raspberrypi:~ $
写真を撮影
カメラモジュールが正常に認識できていることを確認できたら、実際に写真を撮影してみましょう。
写真撮影の操作もコマンドを入力して行います。
LXTerminalで「sudo raspistill -o image.jpg」と入力して実行します。
コマンドを実行すると、撮影画像が画面上に5秒ほど表示されます。
参考
- https://www.raspberrypi.org/documentation/usage/webcams/
- https://uepon.hatenadiary.com/entry/2017/01/22/170349 ーー RaspberryPiでUSB接続のWebカメラを使ってみる
- https://www.pc-koubou.jp/magazine/17276 ーー Raspberry Piとカメラモジュールを接続する