public static void DestroyAllWindows()
{
foreach (KeyValuePair<string, Window> wpair in Windows)
{
Window w = wpair.Value;
if (w == null || w.IsDisposed)
{
continue;
}
NativeMethods.highgui_destroyWindow(w.name);
foreach (KeyValuePair<string, CvTrackbar> tpair in w.trackbars)
{
if (tpair.Value != null)
{
tpair.Value.Dispose();
}
}
//w.Dispose();
}
Windows.Clear();
NativeMethods.highgui_destroyAllWindows();
}