简体   繁体   English

使用OpenCV对从IP摄像机接收到的流进行有效的运动检测

[英]Effective motion detection with OpenCV with stream received from IP Camera

I have two questions which I was struggling finding answers on the net for more than a week. 我有两个问题,我一个多星期都在努力寻找答案。

I'm writing a Windows service on Visual C++ 2017 which connects to Axis IP Cameras on our network and queries MJPEG streams using regular sockets. 我正在Visual C ++ 2017上编写Windows服务,该服务连接到我们网络上的Axis IP摄像机并使用常规套接字查询MJPEG流。 It successfully parses the streams and decodes JPEG images. 它成功解析了流并解码了JPEG图像。 Decoding done with OpenCV; 使用OpenCV进行解码; frame = cv::imdecode(data, IMREAD_GRAYSCALE)). frame = cv :: imdecode(data,IMREAD_GRAYSCALE))。

Q1. Q1。 Although OpenCV uses a performance JPEG library as it claims: build-libjpeg-turbo (ver 1.5.3-62), decoding performance is surprisingly slower than .Net's System.Drawing.Image.FromStream(ms). 尽管OpenCV声称使用了性能JPEG库:build-libjpeg-turbo(版本1.5.3-62),但解码性能却比.Net的System.Drawing.Image.FromStream(ms)慢得多。 Do you have any recommendation for a really fast JPEG decompression? 您对真正快速的JPEG解压缩有什么建议吗?

Q2. Q2。 All I need to do with the received JPEG's is to check "regions of interest" if there is motion in there. 我需要对接收的JPEG进行的所有操作就是检查“感兴趣区域”是否存在运动。 These are production lines in a factory actually. 这些实际上是工厂的生产线。 The factory runs 24 hours and six days a week so there will be changing lighting conditions. 该工厂每周工作24天24天,因此照明条件会不断变化。 Sometimes there won't be light at all so JPEG's will be with plenty of noise on them. 有时根本没有光,因此JPEG上会有很多杂音。 Which OpenCV operations and algorithms you would recommend applying on the frames to have an understanding of if there is a motion at the ROI? 您建议将哪些OpenCV操作和算法应用于框架,以了解ROI是否有运动? Of course you can use plenty of operations on your matrices one after another but I need the shortest and most effective way to keep the resource requirements low as it will be doing this operation for plenty cameras and ROI's at the same time. 当然,您可以一次又一次地对矩阵进行大量操作,但是我需要最短,最有效的方法来保持较低的资源需求,因为它将同时对大量摄像机和ROI进行此操作。

My system is with NVIDIA Video Card (I can use CUDA), Intel i7-7700, 16GB Ram. 我的系统装有NVIDIA显卡(我可以使用CUDA),Intel i7-7700、16GB Ram。

Thank you! 谢谢!

This is not exactly an answer to your question, but it may even be a better approach. 这并不完全是您问题的答案,但它甚至可能是更好的方法。

Axis IP cameras have since long time an on-board motion detection engine than can be configured both via the camera web UI (on old camera models/firmware version it may require using Internet Explorer and the use of an embedded ActiveX control to do that) and via the VAPIX Axis HTTP camera API. 长期以来,Axis IP摄像机都具有板载运动检测引擎,无法通过摄像机Web UI对其进行配置(在旧的摄像机型号/固件版本上,可能需要使用Internet Explorer和使用嵌入式ActiveX控件来进行配置)并通过VAPIX Axis HTTP相机API。

The same VAPIX HTTP API also has commands to receive motion levels and threshold for each configured motion area/window on the camera. 相同的VAPIX HTTP API还具有用于接收摄像机上每个已配置的运动区域/窗口的运动级别和阈值的命令。

If you don't have a recent model that supports VAPIX version 3, you may still rely on VAPIX version 2, you can try issuing an HTTP GET request such as: 如果您没有支持VAPIX版本3的最新模型,则仍然可以依赖VAPIX版本2,可以尝试发出HTTP GET请求,例如:

http:///axis-cgi/motion/motiondata.cgi?group=0,1 http:///axis-cgi/motion/motiondata.cgi?group = 0,1

to get a HTTP multipart stream of the motion level and threshold data (ie for motion area 0 and 1). 获得运动级别和阈值数据的HTTP多部分流(即运动区域0和1)。

For more detailed information, you can download the relevant VAPIX PDF documentation from the Axis website (may require an account and login). 有关更多详细信息,您可以从Axis网站下载相关的VAPIX PDF文档(可能需要一个帐户并登录)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM