title: OpenCV destroyWindow() does not do anything.
body: <p>I have a window that I open just like the OpenCV tutorials show but I want to be able to close the window and do other things in my program. The image displays correctly but when the call to destroyWindow is made it seems to do nothing and just moves to the next line of code. I have also tried destroyAllWindow() as well with the same result. Most of the questions relating to this that I have found are for C, or they just say use destroyWindow() but that is not working for me. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "opencv2/core/core.hpp"
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;//FOR TESTING
  
  
  void MyPause(std::string msg){
      if(msg != ""){
          std::cout &lt;&lt; "[+] " &lt;&lt; msg &lt;&lt; std::endl;
      }
      std::cout &lt;&lt; "Press enter to continue" &lt;&lt; std::endl;
      std::cin.get();
  }
  
  void DisplayMat(cv::Mat img){
      cv::namedWindow( "Input", cv::WINDOW_AUTOSIZE );// Create a window for display.
      cv::imshow( "Input", img );
      cv::waitKey(0);
      cv::destroyWindow("Input");
  
      return;
  }
  
  std::string filename = "/home/nedwards/Code/projectFiles/testMedia/myYellow.jpg";
  
  
  int main(){
  
      DisplayMat(som.inputImg);//just assume that som.input is a correctly opend Mat... it is!
      MyPause("END OF MAIN");
      return 0;
  }
  </code></pre>