赞
踩
前言:环境配置真痛苦,docker度你不迷糊!
参考网站:https://hub.docker.com/r/migoller/shinobidocker
主机系统:ubuntu16.04
配置目的:利用Shinobi组建局域网监控平台
所需软件:docker、Shinobi、ffserver
1.1 docker一键pull镜像
docker pull migoller/shinobidocker
1.2 按照网站中的步骤完成以下部分,其余部分忽略
Dock the "microservice" Shinobi Docker image
mkdir -p [Path to Shinobi direcory]/config [Path to Shinobi direcory]/datadir [Path to Shinobi direcory]/videos
- version: '2'
- services:
- db:
- image: mariadb
- env_file:
- - MySQL.env
- volumes:
- - ./datadir:/var/lib/mysql
- shinobi:
- image: migoller/shinobidocker:microservice-debian
- env_file:
- - MySQL.env
- - Shinobi.env
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - /etc/timezone:/etc/timezone:ro
- - ./config:/config
- - ./videos:/opt/shinobi/videos
- - /dev/shm/shinobiDockerTemp:/dev/shm/streams
- ports:
- - "8080:8080"
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
- MYSQL_USER=majesticflame
- MYSQL_PASSWORD=password
- MYSQL_HOST=db
- MYSQL_DATABASE=ccio
- MYSQL_ROOT_PASSWORD=blubsblawoot
- MYSQL_ROOT_USER=root
- ADMIN_USER=admin@shinobi.video
- ADMIN_PASSWORD=admin
- CRON_KEY=b59b5c62-57d0-4cd1-b068-a55e5222786f
- PLUGINKEY_MOTION=49ad732d-1a4f-4931-8ab8-d74ff56dac57
- PLUGINKEY_OPENCV=6aa3487d-c613-457e-bba2-1deca10b7f5d
- PLUGINKEY_OPENALPR=SomeOpenALPRkeySoPeopleDontMessWithYourShinobi
- MOTION_HOST=localhost
- MOTION_PORT=8080
sudo docker-compose up -d
docker run -d --name [YourMariaDbContainerName] -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -v [Path to your MariaDB server data files]:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=[Your very strong MariaDB root password] -p 3306:3306 mariadb
docker run -d --link [YourMariaDbContainerName]:db -p 8080:8080 -e ADMIN_USER=admin@shinobi.video -e ADMIN_PASSWORD=admin -e MYSQL_USER=majesticflame -e MYSQL_PASSWORD=password -e MYSQL_HOST=db -e MYSQL_DATABASE=ccio -e MYSQL_ROOT_PASSWORD=[Your very strong MariaDB root password] -e MYSQL_ROOT_USER=[Your MariaDB root username] -e CRON_KEY=b59b5c62-57d0-4cd1-b068-a55e5222786f -e PLUGINKEY_MOTION=49ad732d-1a4f-4931-8ab8-d74ff56dac57 -e PLUGINKEY_OPENCV=6aa3487d-c613-457e-bba2-1deca10b7f5d -e PLUGINKEY_OPENALPR=SomeOpenALPRkeySoPeopleDontMessWithYourShinobi -e MOTION_HOST=localhost -e MOTION_PORT=8080 -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -v [Path to your Shinobi data files]/config:/config -v [Path to your Shinobi data files]/datadir:/var/lib/mysql -v [Path to your Shinobi data files]/videos:/opt/shinobi/videos -v /dev/shm/shinobiDockerTemp:/dev/shm/streams migoller/shinobidocker:microservice-debian
- Web Address : http://xxx.xxx.xxx.xxx:8080/super
- Username : admin@shinobi.video
- Password : admin
http://xxx.xxx.xxx.xxx:8080/
配置流媒体服务,ffmpeg将usb摄像头获取的图像信息推送至局域网中的流媒体服务器(ffserver),局域网中其他用户可用rtsp的方式获取usb摄像头的图像流。
对于ffmpeg的流媒体推送理解:https://blog.csdn.net/zouli415/article/details/79652749
ffserver和ffmpeg配置:https://blog.csdn.net/zong596568821xp/article/details/88540455
运行ffserver:
sudo ffserver -f /etc/ffserver.conf
运行ffmpeg:
sudo ffmpeg -f v4l2 -i /dev/video0 -s 640x480 -r 24 -vcodec libx264 -an http://127.0.0.1:8090/feed1.ffm
Shinobi服务器查看:
填写rtsp地址,Full URL PathThe full Stream URL.
选择查看流类型:
参考网站1:https://blog.csdn.net/dieju8330/article/details/85420584
参考网站2:https://github.com/lam2003/v4l2_webstream_server/tree/f64a1f9429c74a110c57f519ac8658057203ca14
吐槽一下:
野路子思路:
调试内容:
Intel RealSense D435的深度图为16bit-depth,RGB图为8bit-depth。
同时,用Intel RealSense D435采集640*480大小的图像,深度图采用CV_16U格式,RGB图采用CV_8UC3格式。
- /*深度图*/
- Mat depth_image(Size(depth_w,depth_h),
- CV_16U,(void*)depth_frame.get_data(),Mat::AUTO_STEP);
- /*RGB图*/
- Mat color_image(Size(color_w,color_h),
- CV_8UC3,(void*)color_frame.get_data(),Mat::AUTO_STEP);
gdb调试时可以看到,深度图dims=2, rows=480, cols=640, step[0]=1280,step[1]=2,RGB图dims=2, rows=480, cols=640, step[0]=1920,step[1]=3。(step[0]是矩阵中一行元素的字节数;step[1]是矩阵中一个元素的字节数),即深度图每一个元素都占用了2个字节存储,RGB图每个元素都占用的3字节存储(分别存储各通道数据)。
- C++: int Mat::depth() const
- The method returns the identifier of the matrix element depth (the type of each individual channel). For example, for a 16-bit signed element array, the method returns CV_16S . A complete list of matrix types contains the following values:
-
- CV_8U - 8-bit unsigned integers ( 0..255 )
- CV_8S - 8-bit signed integers ( -128..127 )
- CV_16U - 16-bit unsigned integers ( 0..65535 )
- CV_16S - 16-bit signed integers ( -32768..32767 )
- CV_32S - 32-bit signed integers ( -2147483648..2147483647 )
- CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )
- CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。