Ask Your Question

Revision history [back]

Why videocapture is not showing any frames?

I'm writing some simple code for opencv3 to process video stream

#include<opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/videoio/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include<iostream>
#include<conio.h>           


int main() {



std::string video = "/videos/video1.avi";
cv::VideoCapture capture(video);

if (!capture.isOpened())
    throw "Error when reading steam_avi";
cv::Mat frame;

for (;;)
{


    capture >> frame;
    if (!frame.empty()) {
        cv::imshow("name", frame);
    }
}


return(0);

}

But I always get a gray window that doesn't show any image what can be my problem?