Ask Your Question

Revision history [back]

Very clear that it will give error...

CvCapture* cvCaptureFromCAM(int index)

Initializes capturing a video from a camera.
Parameter:    index – Index of the camera to be used. If there is only

one camera or it does not matter what camera is used -1 may be passed.

The function cvCaptureFromCAM() allocates and initializes the

CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

To release the structure, use ReleaseCapture.

try that https://www.google.bg/search?q=opencv+open+network+stream&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&gws_rd=cr

Very clear that it will give error...

CvCapture* cvCaptureFromCAM(int index)

Initializes capturing a video from a camera.
Parameter:    index – Index of the camera to be used. If there is only

one camera or it does not matter what camera is used -1 may be passed.

The function cvCaptureFromCAM() allocates and initializes the

CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

To release the structure, use ReleaseCapture.

try that https://www.google.bg/search?q=opencv+open+network+stream&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&gws_rd=crLINK

Very clear that it will give error...

CvCapture* cvCaptureFromCAM(int index)

Initializes capturing a video from a camera.
Parameter:    index – Index of the camera to be used. If there is only

one camera or it does not matter what camera is used -1 may be passed.

The function cvCaptureFromCAM() allocates and initializes the

CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

To release the structure, use ReleaseCapture.

try that LINK

p.p. code, found somewhere... for example:

//MJPEG network stream to OpenCV 2

#include "opencv/cv.h"
#include "opencv/highgui.h"
#include <iostream>

int main(int, char**) {
    cv::VideoCapture vcap;
    cv::Mat image;

    const std::string videoStreamAddress = "pi.pi.pi.pi";

    if(!vcap.open(videoStreamAddress)) {
        std::cout << "Error opening video stream or file" << std::endl;
        return -1;
    }

    for(;;) {
        if(!vcap.read(image)) {
            std::cout << "No frame" << std::endl;
            cv::waitKey();
        }
        cv::imshow("Output Window", image);
        if(cv::waitKey(1) >= 0) break;
    }   
}

Very clear that it will give error...

CvCapture* cvCaptureFromCAM(int index)

Initializes capturing a video from a camera.
Parameter:    index – Index of the camera to be used. If there is only

one camera or it does not matter what camera is used -1 may be passed.

try that LINK

p.p. code, found somewhere... for example:

//MJPEG network stream to OpenCV 2

#include "opencv/cv.h"
#include "opencv/highgui.h"
#include <iostream>

int main(int, char**) {
    cv::VideoCapture vcap;
    cv::Mat image;

    const std::string videoStreamAddress = "pi.pi.pi.pi";
"ip.ip.ip.ip";

    if(!vcap.open(videoStreamAddress)) {
        std::cout << "Error opening video stream or file" << std::endl;
        return -1;
    }

    for(;;) {
        if(!vcap.read(image)) {
            std::cout << "No frame" << std::endl;
            cv::waitKey();
        }
        cv::imshow("Output Window", image);
        if(cv::waitKey(1) >= 0) break;
    }   
}