Skip to main content

Posts

Showing posts with the label Video setting

OpenCV : Show Video and Picture in CLion

1. Show Video by using VideoCapture int main () { VideoCapture capture ( "./res/chat.avi" ); Mat frame ; if ( ! capture .isOpened()){ printf( "AVI file can not open \n " ); return 0 ; } namedWindow( "w" , 0 ); // 0 : resizable, 1 : fit autosize while ( 1 ){ capture >> frame ; if ( frame .empty()) break ; // when arrive at the end of the video     Sobel( frame , frame , frame .depth(), 1 , 0 ); // make color reversal   imshow( "w" , frame ); if (waitKey( 10 ) == 27 ) break ; // 27 is esc key code number } return 0 ; }   2. Read and Show Picture int main () { Mat img = imread( "./res/mh.jpg" ); namedWindow( "win" , 0 ); imshow( "win" , img ); waitKey( 0 ); return 0 ; } Warning! : If you use CLion IDE, you should set proper working directory.