title: Unable to display window via cv::imshow(). What am I missing?
body: <p>I'm working simple intro OpenCV program.  I'm running in Virtualbox (as Ubuntu 20.04). C++/ VS Code.  LLDB debugger.  Same fault if I run the virtualbox on MacOS or Windows.</p>
  <p>---main.cpp---</p>
  <pre><code>#include &lt;opencv2/opencv.hpp&gt;     // Catch all for all libraries within OpenCV
  
  int main()
  {
    cv::VideoCapture cap; //initialize capture
    cap.open(0);
    if (!cap.isOpened()) // check if succeeded to connect to the camera
      CV_Assert(&quot;Cam open failed&quot;);
    cap.set(cv::CAP_PROP_FRAME_WIDTH, 1280);
    cap.set(cv::CAP_PROP_FRAME_HEIGHT, 720);
    // cv::namedWindow(&quot;window&quot;, 1); //create window to show image
  
    while (1)
    {
      cv::Mat image; //Create Matrix to store image
      cap &gt;&gt; image;  //copy webcam stream to image
  
      // If the frame is empty, break immediately
      if (image.empty())
        break;
  
      cv::imshow(&quot;window&quot;, image); //print image to screen. &lt;-- fail here.
      cv::waitKey(33);             //delay 33ms
    }
    return 0;
  }
  </code></pre>
  <p>---CMakeLists.txt---</p>
  <pre><code># https://gist.github.com/UnaNancyOwen/5061d8c966178b753447e8a9f9ac8cf1
  cmake_minimum_required(VERSION 3.0.0)
  set(CMAKE_TOOLCHAIN_FILE &quot;/home/vagrant/Desktop/vcpkg/scripts/buildsystems/vcpkg.cmake&quot;)
  project(openCV_test VERSION 0.1.0)
  add_executable(${PROJECT_NAME} main.cpp)
  
  set(OpenCV_DIR &quot;/home/vagrant/Desktop/vcpkg/installed/x64-linux/share/opencv&quot;)
  # set(WITH_GTK &quot;ON&quot;)    # testing here...
  # set(WITH_QT &quot;OFF&quot;)
  
  find_package(OpenCV REQUIRED)
  
  # Display some variables
  message(STATUS &quot;OpenCV library status:&quot;)
  message(STATUS &quot;    version: ${OpenCV_VERSION}&quot;)
  message(STATUS &quot;    libraries: ${OpenCV_LIBS}&quot;)
  message(STATUS &quot;    include path: ${OpenCV_INCLUDE_DIRS}&quot;)
  
  if( OpenCV_FOUND )
    # Additional Include Directories
    include_directories( ${OpenCV_INCLUDE_DIRS} )
  
    # Additional Library Directories
    link_directories( ${OpenCV_LIB_DIR} )
  
    # Additional Dependencies
    target_link_libraries( ${PROJECT_NAME} ${OpenCV_LIBS} )
  endif()
  </code></pre>
  <p>Note, I've tried manually building the OpenCV package from git repo, and using the VCPKG package manager. Same results either way.  Same fail.  Note, camera works great in virtualbox.  Tested via in virtualbox browser on html5 websites for testing camera use. As I step thru the code, I can see the camera LED come on at appropriate time.  System bombs consistently at cv::imshow() line of code.</p>
  <p>Error message states:</p>
  <blockquote>
  <p>terminate called after throwing an instance of 'cv::Exception'<br />
  what():  OpenCV(4.5.1-dev)
  /home/vagrant/opencv-master/modules/highgui/src/window.cpp:679: error:
  (-2:Unspecified error) The function is not implemented. Rebuild the
  library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu
  or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or
  configure script in function 'cvShowImage'</p>
  </blockquote>
  <p>Here is the class info on the imshow() function:</p>
  <blockquote>
  <p>void cv::imshow(const cv::String &amp;winname, cv::InputArray mat)
  +1 overload</p>
  <p>Displays an image in the specified window. The function imshow
  displays an image in the specified window. If the window was created
  with the cv::WINDOW_AUTOSIZE flag, the image is shown with its
  original size, however it is still limited by the screen resolution.
  Otherwise, the image is scaled to fit the window. The function may
  scale the image, depending on its depth: - If the image is 8-bit
  unsigned, it is displayed as is. - If the image is 16-bit unsigned or
  32-bit integer, the pixels are divided by 256. That is, the value
  range [0,255</p>
  <p>Parameters: winname – Name of the window. mat – Image to be shown.</p>
  </blockquote>
  <p>I've done every combination of installation for both libgtk2.0-dev and pkg-config without result.  I've even installed those libraries before building the OpenCV library with consistent (fail) results.   I know I've used this example on a virtualbox a year ago with success.  It's not at all clear that the error message is an accurate representation of the failure.</p>