如何检查opencv窗口是否已经存在

时间:2014-09-30 19:06:45

标签: c++ opencv

我想知道opencv窗口是否已经存在。一种可能的解决方案是,

std::string winName = "winName";
cv::namedWindow(winName);
HWND* hwnd = (HWND*)(cvGetWindowHandle(winName.c_str()));
if(hwnd == nullptr)
{
    std::cout<<"\n window handle hwnd is null \n";
}
else
{
    std::cout<<"\n window handle hwnd is not null \n";
}

cv::destroyAllWindows();
hwnd = (HWND*)(cvGetWindowHandle(winName.c_str()));
if(hwnd == nullptr)
{
    std::cout<<"\n window handle hwnd is null \n";
}
else
{
    std::cout<<"\n window handle hwnd is not null \n";
} 

但这不是一个跨平台的解决方案。有没有 ?

0 个答案:

没有答案