与非网论坛

标题: 摄像头+yeelink实现监控 [打印本页]

作者: 霹雳之火    时间: 2014-9-3 20:40
标题: 摄像头+yeelink实现监控
本帖最后由 霹雳之火 于 2014-9-5 14:23 编辑

说明:不是可以看到实时监控录像,而是香蕉派可以隔断时间上传照片

0准备
usb摄像头
yeelink申请一个账号(大家都会)
网址:www.yeelink.net/

1 安装抓图软件fswebcam
pi@bananapi:~$ sudo apt-get installfswebcam

2 登录Yeelink, 在用户中心增加一个设备, 再为该设备增加个图像传感器.,如图所示,并注意API KEY图像URL(后面会用到)
(, 下载次数: 183)
(, 下载次数: 147)
(, 下载次数: 166)
3 创建传图片的脚本文件
nano /home/pi/yeelink.sh
并在里面输入下面两行
  1. sudo fswebcam -d /dev/video0 -r 320x240 --bottom-banner --title "BananaPi @ Yeelink" --no-timestamp /home/pi/yeelink.jpg
  2. curl --request POST --data-binary @"/home/pi/yeelink.jpg" --header "U-ApiKey:xxxxxxxx" --url http://?????????
复制代码

sudo fswebcam -d /dev/video0 -r 320x240--bottom-banner --title "BananaPi@ Yeelink" --no-timestamp/home/pi/yeelink.jpg
curl --request POST --data-binary @"/home/pi/yeelink.jpg" --header "U-ApiKey: xxxxxxxxxxxxxxxxxxxx" --url http://???????

xxxxx替换成API KEY
http://???????替换成你的图像URL

4 为脚本增加可执行权限
pi@bananapi:~$ chmod +x yeelink.sh

5 添加例行工作
pi@bananapi:~$ crontab –e
在最后一行加上
*/1 * * * * /home/pi/yeelink.sh
(, 下载次数: 175)
6 监控开始运行,上网页看看效果,每隔一分钟就会上传一张照片,从而实现监控
网址:http://www.yeelink.net/user/devices
(, 下载次数: 166)


作者: outstanding1573    时间: 2014-9-3 21:23
不错啊  更新好快啊  顶起
作者: 霹雳之火    时间: 2014-9-3 22:36
outstanding1573 发表于 2014-9-3 21:23
不错啊  更新好快啊  顶起

哈哈,大家都挺快的
作者: 小菜儿    时间: 2014-9-3 23:03
这个不错,支持
作者: 霹雳之火    时间: 2014-9-4 09:21
小菜儿 发表于 2014-9-3 23:03
这个不错,支持

谢谢版主支持
作者: brucehelen    时间: 2014-9-4 09:48
继续顶,做的非常好
作者: 霹雳之火    时间: 2014-9-4 15:34
brucehelen 发表于 2014-9-4 09:48
继续顶,做的非常好

谢谢支持
作者: zyx呵呵    时间: 2014-9-5 09:35
楼主我的为什么没有图像呢?我按照你的教程来的~~可是就是没看到图像~~求指教~!多谢~!
作者: 霹雳之火    时间: 2014-9-5 09:47
本帖最后由 霹雳之火 于 2014-9-5 09:50 编辑
zyx呵呵 发表于 2014-9-5 09:35
楼主我的为什么没有图像呢?我按照你的教程来的~~可是就是没看到图像~~求指教~!多谢~! ...

是在网页上看不到图像吗?直接运行脚本/home/pi/yeelink.sh看有没有,运行一次就会上传一张,不过有时间限制好像是10s
作者: zyx呵呵    时间: 2014-9-5 13:15
霹雳之火 发表于 2014-9-5 09:47
是在网页上看不到图像吗?直接运行脚本/home/pi/yeelink.sh看有没有,运行一次就会上传一张,不过有时间限 ...

我感觉是我哪里没有弄对,而且你也没有提到的地方,1.添加例行工作:是不是直接输入那句指令就行了,不用按什么使他运行?(这个。。我是小白、、见谅~)还有就是我的建立设备显示异常,是哪有问题,还是没有连接好、、

作者: zyx呵呵    时间: 2014-9-5 13:21
霹雳之火 发表于 2014-9-5 09:47
是在网页上看不到图像吗?直接运行脚本/home/pi/yeelink.sh看有没有,运行一次就会上传一张,不过有时间限 ...

这是我刚才运行的,,还是没有成功,,下面就是代码,,你可不可以帮我分析分析。。
  1. bananapi@lemaker ~ $ /home/bananapi/yeelink.sh

  2. Usage: fswebcam [<options>] <filename> [[<options>] <filename> ... ]

  3. Options:

  4. -?, --help Display this help page and exit.

  5. -c, --config <filename> Load configuration from file.

  6. -q, --quiet Hides all messages except for errors.

  7. -v, --verbose Displays extra messages while capturing

  8. --version Displays the version and exits.

  9. -l, --loop <seconds> Run in loop mode.

  10. -b, --background Run in the background.

  11. -o, --output <filename> Output the log to a file.

  12. -d, --device <name> Sets the source to use.

  13. -i, --input <number/name> Selects the input to use.

  14. -t, --tuner <number> Selects the tuner to use.

  15. -f, --frequency <number> Selects the frequency use.

  16. -p, --palette <name> Selects the palette format to use.

  17. -D, --delay <number> Sets the pre-capture delay time. (seconds)

  18. -r, --resolution <size> Sets the capture resolution.

  19. --fps <framerate> Sets the capture frame rate.

  20. -F, --frames <number> Sets the number of frames to capture.

  21. -S, --skip <number> Sets the number of frames to skip.

  22. --dumpframe <filename> Dump a raw frame frame to file.

  23. -s, --set <name>=<value> Sets a control value.

  24. --revert Restores original captured image.

  25. --flip <direction> Flips the image. (h, v)

  26. --crop <size>[,<offset>] Crop a part of the image.

  27. --scale <size> Scales the image.

  28. --rotate <angle> Rotates the image in right angles.

  29. --deinterlace Reduces interlace artifacts.

  30. --invert Inverts the images colours.

  31. --greyscale Removes colour from the image.

  32. --swapchannels <c1c2> Swap channels c1 and c2.

  33. --no-banner Hides the banner.

  34. --top-banner Puts the banner at the top.

  35. --bottom-banner Puts the banner at the bottom. (Default)

  36. --banner-colour <colour> Sets the banner colour. (#AARRGGBB)

  37. --line-colour <colour> Sets the banner line colour.

  38. --text-colour <colour> Sets the text colour.

  39. --font <[name][:size]> Sets the font and/or size.

  40. --no-shadow Disables the text shadow.

  41. --shadow Enables the text shadow.

  42. --title <text> Sets the main title. (top left)

  43. --no-title Clears the main title.

  44. --subtitle <text> Sets the sub-title. (bottom left)

  45. --no-subtitle Clears the sub-title.

  46. --timestamp <format> Sets the timestamp format. (top right)

  47. --no-timestamp Clears the timestamp.

  48. --gmt Use GMT instead of local timezone.

  49. --info <text> Sets the info text. (bottom right)

  50. --no-info Clears the info text.

  51. --underlay <PNG image> Sets the underlay image.

  52. --no-underlay Clears the underlay.

  53. --overlay <PNG image> Sets the overlay image.

  54. --no-overlay Clears the overlay.

  55. --jpeg <factor> Outputs a JPEG image. (-1, 0 - 95)

  56. --png <factor> Outputs a PNG image. (-1, 0 - 10)

  57. --save <filename> Save image to file.

  58. --exec <command> Execute a command and wait for it to complete.

  59. Warning: Couldn't read data from file "/home/pi/yeelink.jpg", this makes an

  60. Warning: empty POST.

  61. curl: option --headerU-ApiKey:90e974947a3f27cc6d9a03f4c1467e85--url: is unknown

  62. curl: try 'curl --help' or 'curl --manual' for more information

  63. /home/bananapi/yeelink.sh: line 3: http://api.yeelink.net/v1.0/device/13934/sensor/23136/photos: No such file or directory
复制代码

作者: 霹雳之火    时间: 2014-9-5 13:50
本帖最后由 霹雳之火 于 2014-9-5 13:56 编辑
zyx呵呵 发表于 2014-9-5 13:15
我感觉是我哪里没有弄对,而且你也没有提到的地方,1.添加例行工作:是不是直接输入那句指令就行了,不用 ...

是直接输入那句指令就行了,表示每隔1分钟会上传图片
新建一个设备,在这个设备下添加传感器,传感器选择图像传感器
sudo fswebcam -d /dev/video0 -r 320x240 --bottom-banner --title "BananapiPi @ Yeelink" --no-timestamp /home/pi/yeelink.jpg
curl --request POST --data-binary @"/home/pi/yeelink.jpg" --header "U-ApiKey: 这里填APIKEY" --url http:这个链接填你的URL
这个你设置对了吗?

(, 下载次数: 29)

作者: zyx呵呵    时间: 2014-9-5 13:55
霹雳之火 发表于 2014-9-5 13:50
是直接输入那句指令就行了,表示每隔1分钟会上传图片
新建一个设备,在这个设备下添加传感器,传感器选择 ...

嗯~那我就是这样的、、不知道怎么回事了。。
作者: zyx呵呵    时间: 2014-9-5 14:55
顶~~好贴~楼主帮我弄了2个小时,,终于有图像了·~~万分感谢楼主~!
作者: 霹雳之火    时间: 2014-9-5 15:03
zyx呵呵 发表于 2014-9-5 14:55
顶~~好贴~楼主帮我弄了2个小时,,终于有图像了·~~万分感谢楼主~!

不客气
作者: durui2017    时间: 2017-3-5 17:41
这是我刚才运行的,你可不可以帮我分析分析
pi@bpi-iot-ros-ai:~$ sudo apt-get install fswebcam
[sudo] pi 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树      
正在读取状态信息... 完成      
fswebcam 已经是最新版 (20140113-1)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 4 个软件包未被升级。
pi@bpi-iot-ros-ai:~$ nano /home/pi/yeelink.sh
pi@bpi-iot-ros-ai:~$ chmod +x yeelink.sh
pi@bpi-iot-ros-ai:~$ crontab -e
no crontab for pi - using an empty one
crontab: installing new crontab
pi@bpi-iot-ros-ai:~$




欢迎光临 与非网论坛 (https://www.eefocus.com/forum/) Powered by Discuz! X3.5