Last active
February 24, 2017 03:41
-
-
Save happymanx/7e96ccc7ae4e166786ed to your computer and use it in GitHub Desktop.
[OpenCV] Display Image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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; | |
} |
Author
happymanx
commented
Dec 3, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment