1

Good day!

I am using Dev-C++ as my IDE and the library OpenCV. I need to fetch the video taken by my IP camera and process it using the OpenCV. Can someone teach me how will I gonna do it. My OS is windows 7 64 bit. Thank you very much..

user2201682
  • 39
  • 2
  • 2
  • 3
  • possible duplicate of [OpenCV with Network Cameras](http://stackoverflow.com/questions/712998/opencv-with-network-cameras) – Rui Marques Sep 13 '13 at 08:56

1 Answers1

2

if it's a recent opencv version, this might work:

Mat frame;
namedWindow("video", 1);
VideoCapture cap("http://150.214.93.55/mjpg/video.mjpg");
while ( cap.isOpened() )
{
    cap >> frame;
    if(frame.empty()) break;

    imshow("video", frame);
    if(waitKey(30) >= 0) break;
}   

one way or the other, opencv seems to insist, that the url must end with ".mjpg" (dot mjpg), so if it doesn't, add a dummy param to it, like : my/fancy/url?type=.mjpg

berak
  • 39,159
  • 9
  • 91
  • 89
  • This solution is irrelevant to IP Camera . your Code read File From HDD – sam Feb 20 '17 at 14:05
  • @sam - I disagree - this would be the way to read from an IP camera, as an mjpg is typically how they expose the video feed. Most IP cameras I've used will not give you a direct route to the raw image data. – n00dle Nov 13 '18 at 15:46