-2

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!

  • There are plenty of papers regarding motion detection with opencv. What have you tried so far and why is it not working for you? – Dmitrii Z. Dec 04 '18 at 09:58
  • Yes, there are, but I'm asking the best way by means of performance to do it from your experiences on such task. @DmitriiZ. – Ozan Yasin Dogan Dec 04 '18 at 10:02
  • Just curious: why don't you just use the Axis IP camera on-board motion detection and get the result from it? – roalz Dec 04 '18 at 10:54
  • @roalz unfortunately cameras we have on ground are like 5-6 years old and their latest firmware still does not support accessing motion detection features from network. – Ozan Yasin Dogan Dec 04 '18 at 13:18
  • @OzanYasinDogan That sounds strange to me, even old FW supporting old VAPIX 2 API should support motion detection commands via HTTP. Have you tried: http:///axis-cgi/motion/motiondata.cgi?group=0,1 ? That should send you a HTTP multipart stream with motion levels and thresholds for each motion area/group. – roalz Dec 04 '18 at 13:40
  • Can you specify the Axis camera models you have? – roalz Dec 04 '18 at 13:40
  • @roalz Wow! You're very right! I had the firmware version 5.5 and it was very outdated with its controls. VAPIX has really functions and applications for that, I'm working on it now, thank's a lot! That will definitely ease my job much more! – Ozan Yasin Dogan Dec 04 '18 at 16:10
  • @OzanYasinDogan Great! I've added an answer with my above comment and other info, feel free to accept it as answer if you feel it helped you. – roalz Dec 04 '18 at 16:24

1 Answers1

1

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 (i.e. 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).

roalz
  • 2,699
  • 3
  • 25
  • 42
  • Thank you @roalz, it is definitely a better approach instead of doing all on a computer. I have updated the firmwares of the cameras now, it's now version 5.51.5.1 which supports Vapix 3. So after your recommendation, I started to check what can be done, I've seen that the neatest way to monitor motion, it will be listening to motion detection events through RTSP. I will also check ONVIF protocol, the cameras are supporting ONVIF profile S which give event infos about motion. Thank you! – Ozan Yasin Dogan Dec 05 '18 at 14:41
  • @OzanYasinDogan Onvif is the de-facto open standard in videosurveillance cameras and software, but it may be more complex than old-style (but proproetary) HTTP APIs, being based on web-services. Also, Onvif Profile S is somewhat limited regarding the video analytics stuff (configuration, metadata stream and event notification), i.e. Profile T is slightly better, but more recent and not so widely supported as Profile S. – roalz May 11 '20 at 21:23
  • (2) Depending on your needs, you have at least these options; if you want simple, but limited to a single vendor (i.e. Axis), you may choose proprietary HTTP API, if you need to support nearly every camera from any vendor sold recently (latest 5-8 years), but possible more limited, go for Onvif standard protocol (beware, you may need to study a lot and try even more to get something working correctly). – roalz May 11 '20 at 21:27