100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 智能家居(2)——树莓派USB摄像头开发—fswebcam motion

智能家居(2)——树莓派USB摄像头开发—fswebcam motion

时间:2024-04-03 03:34:03

相关推荐

智能家居(2)——树莓派USB摄像头开发—fswebcam motion

树莓派USB摄像头开发—fswebcam、motion

一、简介

fswebcam 这是一款小型摄像头程序官网,则可以很好地支持 USB 摄像头。

二、详细步骤

插好USB摄像头,输入以下指令。

ls -l /dev/video*lsusb

从上面的两个命令,第一个看出来设备中已经有video的设备了,

第二个 中 发现有Sony Playstation Eye 。这两个任何一个都说明了USB摄像头被树莓派检测到了。

三、安装视频监控

apt-get update如果无法安装,请更换源:sudo nano /etc/apt/sources.list

#内容为:

#deb /raspbian/ stretch main contrib non-free rpi

#Uncomment line below then ‘apt-get update’ to enable ‘apt-get source’

#deb-src /raspbian/ stretch main contrib non-free rpi

deb http://mirrors.tuna./raspbian/raspbian/ stretch main contrib non-free rpi

deb-src http://mirrors.tuna./raspbian/raspbian/ stretch main contrib non-free rpi更换源后要重新update:sudo apt-get update安装监控:sudo apt-get install motion修改motion的配置:sudo nano /etc/motion/motion.conf

#deamon off 改成 on

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

daemon on

#设置分辨率

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

width 800

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

height 600

#on修改成off:

#Restrict stream connections to localhost only (default: on)

stream_localhost off

#on修改成off:

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

webcontrol_localhost offsudo nano /etc/default/motion

#no修改成yes:

start_motion_daemon=yes

四、启动监控:

sudo motionhttp://192.168.1.118:8081/

五、退出视频监控

kill -9 2275netstat -apn|grep 8081视频与图像保存目录为:ls /var/lib/motion/删除内容:rm -rf /var/lib/motion/注意:800x600有些卡,默认为:352x288 640x480。

六、用USB Webcam拍照片

要安装fswebcam,这是一款小型摄像头程序。你可以直接通过Raspbian的仓库来安装fswebcam。

sudo apt-get install fswebcamfswebcam安装完成后,在终端中运行下面的命令来抓去一张来自摄像头的照片:

fswebcam --no-banner -r 640x480 image.jpg:-r 指定图片的分辨率,最后的是照片保存的路径。

fswebcam -S 10 image.jpg: -S 参数来跳过前面几帧解决。查看图片:ls image.jpg

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。