Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <opencv2/core/core.hpp> //additional space in header address could cause "not found" problems
  2. #include <opencv2/highgui.hpp >
  3. #include <iostream>
  4. using namespace cv;
  5. using namespace std;
  6. int main() {
  7.  
  8. Mat image1, image2;
  9. image1 = imread("cross.png", CV_LOAD_IMAGE_COLOR);
  10. if (!image1.data) {
  11. cout << "could not find image1" << endl;
  12. }
  13. image2 = imread("cross.png", CV_LOAD_IMAGE_GRAYSCALE);
  14. if (!image2.data) {
  15. cout << "could not find image2" << endl;
  16. }
  17. cout << "opencv test" << endl;
  18. namedWindow("Color Image", WINDOW_AUTOSIZE);
  19. imshow("Color Image", image1);
  20. namedWindow("Gray Scale Image", WINDOW_AUTOSIZE);
  21. imshow("GRAY Scale Image", image2);
  22. waitKey(0);
  23. destroyAllWindows();
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement