首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在树莓Pi运动中使用"on_motion_detected“方法?

如何在树莓Pi运动中使用"on_motion_detected“方法?
EN

Stack Overflow用户
提问于 2016-02-17 22:33:59
回答 5查看 6.7K关注 0票数 0

我一直在使用我的Raspberry Pi 2做一些运动检测使用USB摄像头和运动包,我感到难以置信的沮丧。

有人能向我解释一下on_motion_detected方法是如何工作的吗?

这个想法是,当摄像机检测到运动时,就会执行一个脚本。为了测试目的,这个脚本只是几个单词而已。

视频流在我的本地网络上工作得很好,我可以看到将JPG和.avi文件写入目录的动作。

即使我尝试将我的脚本添加到电影start触发器中,nothing 也不会发生。

我尝试过的一些例子:

  • ;on_motion_detected python /home/pi/Desktop/Python/script.py
  • ;on_movie_start python /home/pi/Desktop/Python/script.py
  • ;on_picture_save sudo /home/pi/Desktop/ python /script.py

我还将脚本更改为不同的目录,推测出权限问题。还是什么都没发生。我已经尝试过移除;在方法之前,仍然什么也没有发生。我尝试过sudo,我尝试过作为脚本执行。拜托有人能帮帮我吗。我已经搜索了多年的线索,但在任何地方都找不到答案。

我的脚本没有被执行。

这个问题被问了1000次,没有人回答。我已经找了好几个小时了。

这里有几个线程已经被解说了:

https://unix.stackexchange.com/questions/59091/problems-running-python-script-from-motion https://www.raspberrypi.org/forums/viewtopic.php?t=86534&p=610482 https://raspberrypi.stackexchange.com/questions/8273/running-script-in-motion

EN

回答 5

Stack Overflow用户

发布于 2016-07-11 19:48:02

Ypu必须删除;这表示对行的注释

;on_motion_detected python /home/pi/Desktop/Python/script.py

代码语言:javascript
复制
 on_motion_detected python /home/pi/Desktop/Python/script.py
票数 2
EN

Stack Overflow用户

发布于 2018-05-15 07:26:22

如果您使用的是线程:warr1.conf,warb2.conf --尝试为它们编写脚本配置。我的线程:线程1.conf

代码语言:javascript
复制
videodevice /dev/video0
text_left USBWebcam-1
target_dir /samba/hdd/share/motion/usb
rotate 180
width 1024
height 768
#webcam_port 9081
#on_event_start /bin/bash /root/scripts/tg_msg.sh
on_picture_save /bin/bash /root/scripts/tg_msg.sh %f
#on_motion_detected /bin/bash /root/scripts/tg_msg.sh
#on_area_detected /bin/bash /root/scripts/tg_msg.sh
#on_movie_start /bin/bash /root/scripts/tg_msg.sh

和线程2.conf:

代码语言:javascript
复制
text_left Foscam IP
netcam_url http://192.168.111.7:8080/video
target_dir /samba/hdd/share/motion/ip
width 1024
height 768
#on_event_start /bin/bash /root/scripts/tg_msg.sh
on_picture_save /bin/bash /root/scripts/tg_msg.sh %f
#on_motion_detected /bin/bash /root/scripts/tg_msg.sh
#on_area_detected /bin/bash /root/scripts/tg_msg.sh
#on_movie_start /bin/bash /root/scripts/tg_msg.sh
票数 0
EN

Stack Overflow用户

发布于 2022-03-03 23:43:25

我有一个简单的解决方案,但需要有人解释这是如何工作的。从根部开始运动。添加一行到/etc/rc.local 'sudo运动‘重新引导,大多数事件将工作,如果启动为根,on_event_end sudo ...command或脚本.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35469118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档