Ask Your Question

Revision history [back]

That is impossible using OpenCV only. However you can do it using Windows API:

cv::namedWindow(m_szWinName, CV_WINDOW_AUTOSIZE);
    // Get window handle. It will return the handle of the video container
    // There is also enclosing parent window, which will be treated later
    m_hMediaWindow = (HWND)cvGetWindowHandle(m_szWinName);

    // change style of the child HighGui window
    DWORD style = ::GetWindowLong(m_hMediaWindow, GWL_STYLE);
    style &= ~WS_OVERLAPPEDWINDOW;
    style |= WS_POPUP;
    ::SetWindowLong(m_hMediaWindow, GWL_STYLE, style);

    // change style of the parent HighGui window
    HWND hParent = ::FindWindow(0, m_szWinName);
    style = ::GetWindowLong(hParent, GWL_STYLE);
    style &= ~WS_OVERLAPPEDWINDOW;
    style |= WS_POPUP;
    ::SetWindowLong(hParent, GWL_STYLE, style);

That It is impossible not a complete answer, but if are using OpenCV only. However Windows, you can do it using Windows API:

cv::namedWindow(m_szWinName, CV_WINDOW_AUTOSIZE);
    // Get window handle. It will return the handle of the video container
    // There is also enclosing parent window, which will be treated later
    m_hMediaWindow = (HWND)cvGetWindowHandle(m_szWinName);

    // change style of the child HighGui window
    DWORD style = ::GetWindowLong(m_hMediaWindow, GWL_STYLE);
    style &= ~WS_OVERLAPPEDWINDOW;
    style |= WS_POPUP;
    ::SetWindowLong(m_hMediaWindow, GWL_STYLE, style);

    // change style of the parent HighGui window
    HWND hParent = ::FindWindow(0, m_szWinName);
    style = ::GetWindowLong(hParent, GWL_STYLE);
    style &= ~WS_OVERLAPPEDWINDOW;
    style |= WS_POPUP;
    ::SetWindowLong(hParent, GWL_STYLE, style);

It is not a complete answer, but if you are using Windows, you can do it using Windows API:

cv::namedWindow(m_szWinName, CV_WINDOW_AUTOSIZE);
    // Get window handle. It will return the handle of the video container
    // There is also enclosing parent window, which will be treated later
    m_hMediaWindow = (HWND)cvGetWindowHandle(m_szWinName);

    // change style of the child HighGui window
    DWORD style = ::GetWindowLong(m_hMediaWindow, GWL_STYLE);
    style &= ~WS_OVERLAPPEDWINDOW;
    style |= WS_POPUP;
    ::SetWindowLong(m_hMediaWindow, GWL_STYLE, style);

    // change style of the parent HighGui window
    HWND hParent = ::FindWindow(0, m_szWinName);
    style = ::GetWindowLong(hParent, GWL_STYLE);
    style &= ~WS_OVERLAPPEDWINDOW;
    style |= WS_POPUP;
    ::SetWindowLong(hParent, GWL_STYLE, style);