Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <opencv2/core/core.hpp>
  2. #include <opencv2/imgcodecs.hpp>
  3. #include <opencv2/highgui/highgui.hpp>
  4.  
  5. #include <iostream>
  6. #include <string>
  7.  
  8. using namespace cv;
  9.  
  10. using namespace std;
  11.  
  12. int main( int argc, char** argv )
  13. {
  14. string imageName("../Desktop/image.jpeg"); // by default
  15. if( argc > 1)
  16. {
  17. imageName = argv[1];
  18. }
  19.  
  20. Mat image;
  21.  
  22. image = imread(imageName.c_str(), IMREAD_COLOR); // Read the file
  23.  
  24. if( image.empty() ) // Check for invalid input
  25. {
  26. cout << "Could not open or find the image" << std::endl ;
  27. return -1;
  28. }
  29.  
  30. namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
  31.  
  32. imshow( "Display window", image ); // Show our image inside it.
  33.  
  34. waitKey(0); // Wait for a keystroke in the window
  35. return 0;
  36. }
  37.  
  38. hello.cpp:2:33: fatal error: opencv2/imgcodecs.hpp: No such file or directory
  39. #include <opencv2/imgcodecs.hpp>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement