destroyWindow

头文件:opencv2/highgui/highgui.hpp
作用:关闭指定窗口
函数原型:

void destroyWindow(const string& winname);
  • 参数1 winname ,需要关闭的窗口的名称

示例:

#include<iostream>
#include<opencv2/highgui/highgui.hpp>
using namespace std;
int main(int argc,char **argv){
    cv::Mat image = cv::imread("C:/Users/Administrator/Desktop/2-1.jpg", cv::IMREAD_GRAYSCALE);
    cv::imshow("窗口名", image);
    cv::waitKey(5000);    //等待5000ms
    cv::destroyWindow("窗口名");
    return 0;
}
Last modification:August 10th, 2020 at 02:58 pm