IP camera and OPENCV


Answers

cv::VideoCapture works for webcams but not IP cameras?

Solved it by copying opencv_ffmpeg.dll from the build\x86\mingw\bin folder of the sources and pasting it next to built DLLs (bin folder accessible through PATH): I have no idea why, but the opencv_ffmpeg_64.dll had been produced instead.

Question

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




How to access an IP camera using OpenCV (C++ code) ? is there a way to access with OpenCv+vlc ? (windows 7)

Here's the code which worked for me.

#include <opencv\cv.h>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>
#include <stdio.h>

using namespace std;
using namespace cv;

int main()
{
    Mat frame;
    namedWindow("video", 1);
    VideoCapture cap("http://USERID:PASSWORD@IPADDRESS:PORT/video.cgi?resolution=640x360&req_fps=50&.mjpg");
    if(!cap.isOpened())
    {
        cout<<"Camera not found"<<endl;
        getchar();
        return -1;
    }
    while ( cap.isOpened() )
    {
        cap >> frame;
        if(frame.empty()) break;

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



opencv_ffmpeg**.dll error in OpenCV 2.4.11 for IP Camera Access?

I'd guess you might be missing the mjpg suffix. See this answer.




Links



Tags