RenHao

linux_cv_test

May 10th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <opencv2/core/core.hpp>
  2. #include <opencv2/highgui/highgui.hpp>
  3. #include <iostream>
  4. using namespace cv;
  5. using namespace std;
  6. int main( int argc, char** argv ) {
  7.     if( argc != 2) {
  8.      cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
  9.      return -1;
  10.     }
  11.     Mat image;
  12.     // Read the file
  13.     image = imread(argv[1], CV_LOAD_IMAGE_COLOR);
  14.     if(! image.data ) { // Check for invalid input
  15.         cout <<  "Could not open or find the image" << std::endl ;
  16.         return -1;
  17.     }
  18.     // Create a window for display.
  19.     namedWindow( "Display window", WINDOW_AUTOSIZE );
  20.     // Show our image inside it.
  21.     imshow( "Display window", image );
  22.     // Wait for a keystroke in the window
  23.     waitKey(0);
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment