Skip to content

Instantly share code, notes, and snippets.

@happymanx
Last active February 24, 2017 03:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save happymanx/7e96ccc7ae4e166786ed to your computer and use it in GitHub Desktop.
Save happymanx/7e96ccc7ae4e166786ed to your computer and use it in GitHub Desktop.
[OpenCV] Display Image
/**
Theme: Display Image
IDE: Xcode 7, OSX 10.10
Language: C++, OpenCV 2.4.12
Date: 104/12/04
Author: HappyMan
Blog: http://cg2010studio.wordpress.com/
*/
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat image;
// Read the file
image = imread("fang.jpg", CV_LOAD_IMAGE_COLOR);
if(!image.data) {
// Check for invalid input
cout << "Could not open or find the image" << endl;
return -1;
}
// Create a window to display
namedWindow("Happy window", WINDOW_AUTOSIZE);
imshow("Happy window", image);
// Show our image inside it
waitKey(0);
// Wait for a keystroke in the window
return 0;
}
@happymanx
Copy link
Author

display image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment