title: How can I stitch images from video cameras in real time?
body: <p>I use 4 stationary cameras. Cameras <strong>do not move relative to each other</strong>. And I want to stitch video images from them into the one video image <strong>in real time</strong>.</p>
  
  <p>I use for this OpenCV 2.4.10, and <a href="http://docs.opencv.org/modules/stitching/doc/high_level.html#stitcher"><code>cv:stitcher</code></a> class, like this:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>// use 4 video-cameras
  cv::VideoCapture cap0(0), cap1(1), cap2(2), cap3(3);
  
  bool try_use_gpu = true;    // use GPU
  cv::Stitcher stitcher = cv::Stitcher::createDefault(try_use_gpu);
  stitcher.setWarper(new cv::CylindricalWarperGpu());
  stitcher.setWaveCorrection(false);
  stitcher.setSeamEstimationResol(0.001);
  stitcher.setPanoConfidenceThresh(0.1);
  
  //stitcher.setSeamFinder(new cv::detail::GraphCutSeamFinder(cv::detail::GraphCutSeamFinderBase::COST_COLOR_GRAD));
  stitcher.setSeamFinder(new cv::detail::NoSeamFinder());
  stitcher.setBlender(cv::detail::Blender::createDefault(cv::detail::Blender::NO, true));
  //stitcher.setExposureCompensator(cv::detail::ExposureCompensator::createDefault(cv::detail::ExposureCompensator::NO));
  stitcher.setExposureCompensator(new cv::detail::NoExposureCompensator());
  
  
  std::vector&lt;cv::Mat&gt; images(4);
  cap0 &gt;&gt; images[0];
  cap1 &gt;&gt; images[1];
  cap2 &gt;&gt; images[2];
  cap3 &gt;&gt; images[3];
  
  // call once!
  cv::Stitcher::Status status = stitcher.estimateTransform(images);
  
  
  while(true) {
  
      // **lack of speed, even if I use old frames**
      // std::vector&lt;cv::Mat&gt; images(4);
      //cap0 &gt;&gt; images[0];
      //cap1 &gt;&gt; images[1];
      //cap2 &gt;&gt; images[2];
      //cap3 &gt;&gt; images[3];
  
      cv::Stitcher::Status status = stitcher.composePanorama(images, pano_result);
  }
  </code></pre>
  
  <p>I get only 10 FPS (frame per seconds), but I need 25 FPS.
  How can I accelerate this example?</p>
  
  <p>When I use <code>stitcher.setWarper(new cv::PlaneWarperGpu());</code> then I get a very enlarged image, this I do not need.</p>
  
  <p>I need <strong>only - Translations</strong>.</p>
  
  <p>For example, I'm ready to don't use:</p>
  
  <ul>
  <li>Perspective transformation</li>
  <li>Scale operations</li>
  <li>and may be even Rotations</li>
  </ul>
  
  <p>How can I do it? Or how can I get from <code>cv::Stitcher stitcher</code> parameters <code>x,y</code> of translations for each of images?</p>
  
  <p><strong>UPDATE - profiling in MSVS 2013 on Windows 7 x64:</strong>
  <img src="https://i.stack.imgur.com/S7gCu.png" alt="enter image description here"></p>