[Cortex-A] 【A10-OlinuXino-LIME试用】9. 家庭监控--移动物体监控检测motion

[复制链接]
1979|1
 楼主| ICLYL 发表于 2018-3-4 15:52 | 显示全部楼层 |阅读模式
本帖最后由 ICLYL 于 2018-3-4 15:52 编辑

首先贴出两个网址
官网指南:http://www.lavrsen.dk/foswiki/bin/view/Motion
github源代码:https://github.com/sackmotion/motion

家庭移动物体监控其实就是利用摄像头监控某个区域,当有人或者物体经过是,摄像头边自动抓拍移动物体,保存在硬盘上。
现在就用motion搭建监控设配

  1. sudo apt-get install motion
过程如下所示:
360截图20180224162134269.jpg

360截图20180224162144997.jpg

要想查看motion.conf配置的参数,可以参考下面网址
https://motion-project.github.io/motion_config.html

修改配置文件
  1. vim /etc/motion/motion.conf

这里介绍几个常见的
daemon设置为on
width设置摄像头支持分辨率的宽,height设置摄像头支持的分辨率的高,framerate设置摄像头支持的FPS帧率
threshold设置移动检测的灵敏度,数值越小越灵敏,默认为1500,设置为3000-5500即可
event_gap是事件间隔事件,设置为0为不间断拍摄,默认为60秒
stream_localhost是只允许本机查看视频流,默认on,如果需要局域网或者外网查看设置为off
stream_authentication是视频流加密,设置用户名:密码后需要输入用户名和密码到登陆框才能查看视频流
webcontrol_localhost是只允许本机网页管理,默认是on,如果需要局域网或者外网登陆网页管理界面需要设置为off
webcontrol_authentication是网页管理加密,设置用户名:密码后需要输入账号密码才能登陆网页管理界面

修改好后(当然遇到以下小bug,这里就不介绍了),运行会出现如下所示:
360截图20180226142939010.jpg

[0] Motion thread 1 restart
[1] Thread 1 started
[1] cap.driver: "uvcvideo"
[1] cap.card: "USB2.0 PC CAMERA"
[1] cap.bus_info: "usb-sw-ehci-1"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] Unable to query input -1 VIDIOC_ENUMINPUT: Invalid argument
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
[1] Could not fetch initial image from camera
[1] Motion continues using width and height from config file(s)
[1] Resizing pre_capture buffer to 1 items
[1] bind(): Address already in use
[1] Problem enabling stream server in port 8081: Address already in use
[1] Thread exiting
[0] Motion thread 1 restart
[1] Thread 1 started
[1] cap.driver: "uvcvideo"
[1] cap.card: "USB2.0 PC CAMERA"
[1] cap.bus_info: "usb-sw-ehci-1"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] Unable to query input -1 VIDIOC_ENUMINPUT: Invalid argument
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
[1] Could not fetch initial image from camera
[1] Motion continues using width and height from config file(s)
[1] Resizing pre_capture buffer to 1 items
[1] bind(): Address already in use
[1] Problem enabling stream server in port 8081: Address already in use
[1] Thread exiting

遇到这种情况是摄像头已经在运行中,重复输入motion指令的原因

表示摄像头设备已经启动,在游览器上输入http://ip地址:8081
就可以看到摄像头拍摄的视频,如下所示
360截图20180226135631469.jpg QQ截图20180226135114.png
当然,游览器观测的视频有几秒钟的延迟。。。

远程监控成功后,再来设置移动物体的检测

locate,定位移动的物体,把它修改成为on,会把移动的物体框起来
on_motion_detected # 在检测到移动物体时执行什么命令或者程序。


但是我实际中使用时,根本不可以检测移动物体
后来我仔细查看motion配置文件过程中,
发现 output_motion 参数才是移动物体检测,设置为on
(还是多多看配置文档的注释)
360截图20180226202032681.jpg

保存,重新service motion restart
可以看到有一个白色的框框选了移动物体,在配置文件中没有发现白色框颜色的设置
360截图20180226201626675.jpg

360截图20180226202211177.jpg

最后设置储存地址:target_dir是拍摄照片或视频存储目录,这里设置为挂载U盘的/mnt/usb/motion目录
到此为止,家庭安全监控系统搭建完成,可以通过远程网址实时监控家庭情况。
FTP远程服务器还可以访问移动硬盘。



dirtwillfly 发表于 2018-3-8 08:17 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

89

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部