05-07 03:51
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

[OpenCV] Display an Image 본문

Programming/OpenCV

[OpenCV] Display an Image

cinema4dr12 2014. 8. 5. 12:37

main.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Mat.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <opencv2\opencv.hpp>
#include <iostream>
 
using namespace std;
using namespace cv;
 
int _tmain(int argc, char** argv)
{
    IplImage *pImage = cvLoadImage("[IMAGE_PATH]/[IMAGE_NAME]", CV_LOAD_IMAGE_COLOR);
    Mat img(pImage);
 
    // Check for invalid input
    if(! img.data )
    {
        cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }
    // Create a window for display.
    namedWindow( "Display window", WINDOW_AUTOSIZE );
    // Show our image inside it.
    imshow( "Display window", img );
 
    // Wait for a keystroke in the window
    waitKey(0);
    return 0;
}
cs


Comments