简体   繁体   中英

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. It successfully parses the streams and decodes JPEG images. Decoding done with OpenCV; frame = cv::imdecode(data, IMREAD_GRAYSCALE)).

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). Do you have any recommendation for a really fast JPEG decompression?

Q2. All I need to do with the received JPEG's is to check "regions of interest" if there is motion in there. 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. Sometimes there won't be light at all so JPEG's will be with plenty of noise on them. 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? 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.

My system is with NVIDIA Video Card (I can use 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.

The same VAPIX HTTP API also has commands to receive motion levels and threshold for each configured motion area/window on the camera.

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:

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).

For more detailed information, you can download the relevant VAPIX PDF documentation from the Axis website (may require an account and login).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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