Ask Your Question

dablak's profile - activity

2013-07-18 04:43:11 -0600 received badge  Editor (source)
2013-07-18 04:33:34 -0600 asked a question IP camera disconnection and reconnection issues

I'm reading images from a camera through HTTP. This is the code:

Mat src;
VideoCapture cap();
cap.open("http://192.168.1.10:8008"); // IP camera

while(1) {
    cap.read(src);
    // Other code
}

It works perfectly, but after running for a while if I physically disconnect the camera then the code hangs forever in cap.read(src);.

I need some way to return from read if, let's say, after 5 seconds there is no new image.

There is another problem. If the camera is reconnected while the program is waiting in read then it keeps hanged anyway. It would be good if VideoCapture is able to grab frames again once the camera is reconnected.