Ask Your Question

Revision history [back]

And to complement my suggestion made, try this code in C++, you can already see how much easier it is :)

include “highgui.h”

include "stdio.h"

int main( int argc, char** argv ) { VideoCaptuee capture ( argv[1] ); Mat frame; for(;;){ capture >> frame;\ f( !frame ) { printf("EMPTY OR NULL"); break;//ends HERE!!!!! } cvShowImage( “Example2”, frame );
char c = cvWaitKey(33); if( c == 27 ) break; }

cvReleaseCapture( &capture ); cvDestroyWindow( “Example2” );

}

click to hide/show revision 2
No.2 Revision

And to complement my suggestion made, try this code in C++, you can already see how much easier it is :)

include “highgui.h”

#include “highgui.h”  #include "stdio.h"
 

include "stdio.h"

int main( int argc, char** argv ) { VideoCaptuee capture ( argv[1] ); Mat frame; for(;;){ capture >> frame;\ f( !frame ) { printf("EMPTY OR NULL"); break;//ends HERE!!!!! } cvShowImage( “Example2”, frame );
char c = cvWaitKey(33); if( c == 27 ) break; }

}

cvReleaseCapture( &capture ); cvDestroyWindow( “Example2” );

); }

}

And to complement my suggestion made, try this code in C++, you can already see how much easier it is :)

#include “highgui.h” 
#include "stdio.h"

int main( int argc, char** argv ) { 
     VideoCaptuee VideoCapture capture ( argv[1] );
     Mat frame;
     for(;;){
         capture >> frame;\
f( !frame ) frame;
         if ( frame.empty() ){  {              cout << "No frame read from video" << endl;
             break;  printf("EMPTY OR NULL");
break;//ends HERE!!!!!
 }
cvShowImage( “Example2”, frame );  
char c = cvWaitKey(33);
if( c == 27 ) break;
        imshow("Example", frame);
         waitKey(0);
     }

cvReleaseCapture( &capture );
cvDestroyWindow( “Example2” );

}
click to hide/show revision 4
No.4 Revision

updated 2013-08-17 03:59:47 -0600

berak gravatar image

And to complement my suggestion made, try this code in C++, you can already see how much easier it is :)

#include “highgui.h” "opencv2/highgui/highgui.hpp" 
#include "stdio.h"

int main( int argc, char** argv ) { 
     VideoCapture cv::VideoCaptuee capture ( argv[1] );
     Mat cv::Mat frame;
     for(;;){
for(;;) {
         capture >> frame;
         if ( if( frame.empty() ){ )  {  cout << "No frame read from video" << endl;
printf("EMPTY OR NULL");
 break; 
break;//ends HERE!!!!!
         }
         imshow("Example", frame);
cv::imshow( "Example2", frame );  
 waitKey(0);
char c = cv::waitKey(33);
 }
    if( c == 27 ) break;
    }    
}