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:
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 *****
please ask your question here .
I have edited the question
things you could try:
cerr << frame.size() << endl; cerr << frame(Rect(60,60,20,20)) << endl
If your saved image is black, then it has something to do with your capture interface.