Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. // test.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "opencv2/highgui/highgui.hpp"
  6. #include <iostream>
  7.  
  8. using namespace cv;
  9. using namespace std;
  10.  
  11.  
  12. int _tmain(int argc, _TCHAR* argv[])
  13. {
  14. Mat img = imread("MyPic.JPG", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "MyPic.JPG" and store it in 'img'
  15.  
  16. if (img.empty()) //check whether the image is loaded or not
  17. {
  18. cout << "Error : Image cannot be loaded..!!" << endl;
  19. //system("pause"); //wait for a key press
  20. return -1;
  21. }
  22.  
  23. namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
  24. imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window
  25.  
  26. waitKey(0); //wait infinite time for a keypress
  27.  
  28. destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement