-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathShowImage.cpp
More file actions
35 lines (24 loc) · 795 Bytes
/
Copy pathShowImage.cpp
File metadata and controls
35 lines (24 loc) · 795 Bytes
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
31
32
33
34
35
#include <opencv2/opencv.hpp>
#include <iostream>
#include <string>
//https://docs.opencv.org/4.x/db/df5/tutorial_linux_gcc_cmake.html
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
// Read the image file
Mat image = imread("C:/GitHub/ObjectDetection/ObjectDetection/Project 001.jpg");
if (image.empty()) // Check for failure
{
cout << "Could not open or find the image" << endl;
system("pause"); //wait for any key press
return -1;
}
String windowName = "My HelloWorld Window"; //Name of the window
namedWindow(windowName); // Create a window
imshow(windowName, image); // Show our image inside the created window.
waitKey(0); // Wait for any keystroke in the window
destroyWindow(windowName); //destroy the created window
return 0;
}