0

i have succcessfully implemented TLD and face detection algorithms in opencv on realtime webcam stream and it shows realtime response . Then i wanted to do the same on ipcamera video stream . Firstly , i tried ipcamera video streaming using opencv ( without object detection) and it had almost no lag (nearly realtime). when i altered to process it, it gives same fps but gets delayed by 3-4 seconds . Found on internet there is something like buffers in which image frames of ip camera stream is stored and causes delay but couldnt solve the problem.

some of my relevant code :

VideoCapture captureDevice;
string videoStreamAddress = "http://admin:admin@192.168.0.251:80/video/mjpg.cgi?&.mjpg";
// in loop
captureDevice>>frame;
Marc B
  • 356,200
  • 43
  • 426
  • 500
sid
  • 1
  • 1
    there's a difference between "suck down some bytes and display them" and "suck down some bytes, do heavy duty image analysis on those bytes, then display them". – Marc B Feb 06 '15 at 20:17
  • Does your delay come from the ip cam or from the object detection (test this by disabling object detection code) if it comes from detection, the difference to your webcam test might be the image resolution? – Micka Feb 06 '15 at 20:37
  • it comes after detection , and even lowest resolution doesnt improveit , it works realtime for hd 1080p webcam but lags on 640p ipcam , whyyyy ? :( – sid Feb 06 '15 at 21:37
  • Using webcam if i track the 90% of the windows , it is still realtime, but in ip-camera , a smallest ROI gives delay :( – sid Feb 06 '15 at 21:40
  • Impossible to tell without knowing detection algorithm and images – Micka Feb 07 '15 at 09:45
  • Finally solved the problem by my own . using a 3 iteration loop in my main loop: for(int i=0; i<2; i++) { captureDevice>>frame; } This lowered the frame rates to 14fps , but with no delays( caused due to buffering ), Other approach i found is to create seperate thread for capturing frames and processing it . – sid Feb 09 '15 at 16:26

0 Answers0