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 = "http://hg55.no-ip.org/mjpg/video.mjpg";
    //Yes, this stream does work! Try to paste it into your browser...

    //open the video stream and make sure it's opened
    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;
    }   
}

このコードはストリームを開くことができません...

コードは、このスレッドのコードに基づいています: OpenCV with Network Cameras

ここの OpenCV 1 コードは問題なく動作します。

事前にどうもありがとうございました

4

1 に答える 1

1

OpenCV 2.3.1 ではなく、Visual Studio 2010 とOpenCV 2.2で新しいプロジェクトを作成しようとしました。

これですべての問題が解決しました!

于 2012-02-09T20:11:03.813 に答える