Example Intro 100: Display image.

#include "pch.h"


#include <opencv2/highgui/highgui.hpp>
#include <iostream>


using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
if (argc != 2)
{
cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}

Mat image;
String value = argv[1];
image = imread(argv[1], IMREAD_COLOR);   // Read the file

if (!image.data)                              // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}

namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Display window", image);                   // Show our image inside it.

waitKey(0);                                          // Wait for a keystroke in the window
return 0;
}


https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_image_display/py_image_display.html

Comments

Popular posts from this blog

OpenCV Programming 1

Opencv Drawing Functions