title: Efficient integration of Qt and OpenCV
body: <p>I am working on an interactive application which needs to read and manipulate several very large images at once (25 images at a time, roughly 350 Mb total size). OpenCV is quite speedy and handles the algorithms with relative ease. But drawing them with Qt is proving to be a problem. Here are two less-than-ideal solutions I have tried.</p>
  
  <blockquote>
    <p><strong>Solution 1 (too slow)</strong></p>
    
    <p>Every time you need to draw a different OpenCV image, convert it to a
    <code>QImage</code> and draw that. The conversion, unfortunately, takes a while and
    we cannot switch between images at interactive speeds.</p>
    
    <p><strong>Solution 2 (too memory-intensive)</strong></p>
    
    <p>Maintain two stacks of images, one for OpenCV and one for Qt. Use the
    appropriate one at the appropriate time.</p>
  </blockquote>
  
  <p>I have direct access to the OpenCV pixel data. I know the width and height of the image, and I know that pixels are 3-byte RGB values. It seems like it should be possible to draw the OpenCV image quickly without copying it to a <code>QImage</code> container that (as far as I can tell) just contains a duplicate of the data.</p>
  
  <p>Where do I need to look to get this kind of capability out of Qt?</p>