Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imshow shows black screen

I did create a project where everything was running as intended. Then I reinstalled my system, copied the project and I get black screen when showing any frame of proccessed video. Question posted on SO: Stack Overflow Q

I have installed all possible codecs I. Even the FFMPEG which I didn't need last time I was running the project.

imshow shows black screen

I did create a project where everything was running as intended. Then I reinstalled my system, copied the project and I get black screen when showing any frame of proccessed video. Question posted on SO: Stack Overflow QMy simple code:

#include <cstdio>
#include "opencv2/opencv.hpp"
#include <iostream>
#include <sstream>

using namespace cv;
using namespace std;

int main(int, char**)
{
VideoCapture cap("videofile.avi"); 
if (!cap.isOpened())  // check if we succeeded
return -1;

namedWindow("Frame", 1);
for (;;)
{
    Mat frame;
    if (!cap.read(frame)) {
        cerr << "Unable to read next frame." << endl;
        cerr << "Exiting..." << endl;
        exit(EXIT_FAILURE);
    }

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

return 0;
}

The output I am getting: imshow output

I have installed all possible codecs I. Even the FFMPEG which I didn't need last time I was running the project.

imshow shows black screen

I did create a project where everything was running as intended. Then I reinstalled my system, copied the project and I get black screen when showing any frame of proccessed video. My simple code:

#include <cstdio>
#include "opencv2/opencv.hpp"
#include <iostream>
#include <sstream>

using namespace cv;
using namespace std;

int main(int, char**)
{
VideoCapture cap("videofile.avi"); 
if (!cap.isOpened())  // check if we succeeded
return -1;

namedWindow("Frame", 1);
for (;;)
{
    Mat frame;
    if (!cap.read(frame)) {
        cerr << "Unable to read next frame." << endl;
        cerr << "Exiting..." << endl;
        exit(EXIT_FAILURE);
    }

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

return 0;
}

The output I am getting: imshow output

I have installed all possible codecs I. Even the FFMPEG which I didn't need last time I was running the project.

There's also this log in console which has never been there before

***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****