title: Showing an image using OpenCV 2.2 on a Linux Ubuntu platform with Qt
body: <p>I'm using <a href="http://qt.nokia.com/products/" rel="nofollow noreferrer">Qt</a> as my C++ IDE platform over Ubuntu 10.10 with OpenCV 2.2.</p>
  <p>I'll just write pieces of code and show where the problem is:</p>
  <pre><code>#include &quot;opencv2/highgui/highgui.hpp&quot;
  
  using namespace cv;
  
  int main(int argc, char *argv[])
  {       
      VideoCapture cap = VideoCapture(0);
      Mat frame;
      do
      {
          cap &gt;&gt; frame;
          imshow(&quot;frame&quot;,frame);
      } while (waitKey(10) != 27);
      return 0;
  }
  </code></pre>
  <p>I get 3 warning printouts that seems something like this:</p>
  <pre><code>VIDIOC_QUERYMENU: Invalid argument
  </code></pre>
  <p>And everything seems to be fine (the camera works).</p>
  <p>I had to add usage of the Qt and added 3 lines of code, and it looks like this:</p>
  <pre><code>#include &lt;QApplication&gt;
  #include &quot;opencv2/highgui/highgui.hpp&quot;
  
  using namespace cv;
  
  int main(int argc, char *argv[])
  {
      QApplication app(argc,argv);       
      VideoCapture cap = VideoCapture(0);
      Mat frame;
      do
      {
          cap &gt;&gt; frame;
          imshow(&quot;frame&quot;,frame);
      } while (waitKey(10) != 27);
      
      return app.exec();
  }
  </code></pre>
  <p>I still get the 3 warning lines but now, the &quot;frame&quot; window is grey, and nothing is shown.</p>
  <p>This is my first time using Qt, so I don't really know how it works. I can only guess that QApplication is getting control over the window management, that causes the <code>imshow</code> command to not be able to open a new window.</p>