Goal
In this tutorial you will learn how to:
- Load an image (using cv::imread )
- Create a named OpenCV window (using cv::namedWindow )
- Display an image in an OpenCV window (using cv::imshow )
Source Code
Download the source code from here.
#include <opencv2/highgui.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
if( argc > 1)
{
imageName = argv[1];
}
Mat image;
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
waitKey(0); // Wait for a keystroke in the window
return 0;
}
