-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
29 lines (23 loc) · 865 Bytes
/
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
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
cout << "start\n";
// Read an image
Mat src = imread("img/Beauty.jpg");
if (src.empty()) {
printf("could not open");
return -1;
}
namedWindow("input", WINDOW_NORMAL); // Create a window with the given title and automatic image size
// In OpenCV 3, use namedWindow("input", CV_WINDOW_AUTOSIZE)
resizeWindow("input", src.cols/2, src.rows/2); // Resize the window to match the image size
imshow("input", src); // Display the image in the "input" window
waitKey(0); // Prevent the window from closing immediately, wait for user input
destroyAllWindows(); // Destroy all windows
return 0;
}