/
Alx89
/
OpenCV
Обзор
Документация
Войти
/
Alx89
/
OpenCV
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
4.x
samples/cpp/tutorial_code/introduction/display_image/display_image.cpp
39 строк
744 B
mehlukas
Merge pull request #16889 from mehlukas:3.4-consolidateImshow
07 апр 2020, 17:14
Не верифицирован
07 апр 2020, 17:14
75bd9f8
Код
Авторство
О чём код?
//! [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; }