init - 初始化项目

This commit is contained in:
Lee Nony
2022-05-06 01:58:53 +08:00
commit 90a5cc7cb6
6772 changed files with 2837787 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
//! [includes]
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
using namespace cv;
//! [includes]
int main()
{
//! [imread]
std::string image_path = samples::findFile("starry_night.jpg");
Mat img = imread(image_path, IMREAD_COLOR);
//! [imread]
//! [empty]
if(img.empty())
{
std::cout << "Could not read the image: " << image_path << std::endl;
return 1;
}
//! [empty]
//! [imshow]
imshow("Display window", img);
int k = waitKey(0); // Wait for a keystroke in the window
//! [imshow]
//! [imsave]
if(k == 's')
{
imwrite("starry_night.png", img);
}
//! [imsave]
return 0;
}