Ask Your Question

Revision history [back]

OpenCv 3.2 Video file not displaying only header displays

I am trying to get OpenCv3.2 to open a video file but it only opens the window header. I am using a MacBook pro mid-2015 version and using C++ on Xcode. It is definitely reading it but nothing displays. Any help would be deeply appreciated.

using namespace cv;
using namespace std;

int main(int argc, char** argv){
   cvNamedWindow("xample2", CV_WINDOW_AUTOSIZE);
VideoCapture capture("/filename.mp4");
Mat frame;

if(!capture.isOpened()) {
    cout << "Could not open file" << endl;
    return -1;
}
while(true) {
    capture >> frame;
    if(frame.empty()) break;
    imshow( "xample2", frame );
    char c = cvWaitKey(1000);
    if( c == 27 ) break;
}

}

click to hide/show revision 2
retagged

updated 2017-06-26 02:14:30 -0600

berak gravatar image

OpenCv 3.2 Video file not displaying only header displays

I am trying to get OpenCv3.2 to open a video file but it only opens the window header. I am using a MacBook pro mid-2015 version and using C++ on Xcode. It is definitely reading it but nothing displays. Any help would be deeply appreciated.

using namespace cv;
using namespace std;

int main(int argc, char** argv){
   cvNamedWindow("xample2", CV_WINDOW_AUTOSIZE);
VideoCapture capture("/filename.mp4");
Mat frame;

if(!capture.isOpened()) {
    cout << "Could not open file" << endl;
    return -1;
}
while(true) {
    capture >> frame;
    if(frame.empty()) break;
    imshow( "xample2", frame );
    char c = cvWaitKey(1000);
    if( c == 27 ) break;
}

}