ошибка сегментации при попытке прочитать видео с помощью opencv - PullRequest
0 голосов
/ 29 апреля 2019

Я пытаюсь прочитать видео с помощью opencv2.4.13. Код написан на cpp. «Ошибка сегментации (дамп ядра) произошла в video_capture= cv::VideoCapture(video_fname);. Пожалуйста, сообщите. Спасибо

int main(int argc, char *argv[])
{
    if(argc != 2) {
        printf("must provide one command argument with the video file or stream to open\n");
        return 1;
    }
    std::string video_fname;
    video_fname = std::string(argv[1]);
    cv::VideoCapture video_capture;
    bool from_camera = false;
    if(video_fname == "0") {
       video_capture = cv::VideoCapture(0);
       from_camera = true;
    } else {
       std::cout<<"i am here"<<std::endl;

       video_capture=  cv::VideoCapture(video_fname);
    }


    if(!video_capture.isOpened()) {

       fprintf(stderr, "could not open video %s\n", video_fname.c_str());
       video_capture.release();
       return 1;
    }
}

....
return 0;
}
...