title: Stitching 2 images in opencv
body: <p>I'm trying to stitch 2 images just for start for panography. I"ve already found keypoints, found homography using RANSAC but I can't figure out how to align these 2 images (i'm new at opencv). Now part of code</p>
  
  <pre><code>vector&lt;Point2f&gt; points1, points2;
  for( int i = 0; i &lt; good_matches.size(); i++ )
  {
      //-- Get the keypoints from the good matches
      points1.push_back( keypoints1[ good_matches[i].queryIdx ].pt );
      points2.push_back( keypoints2[ good_matches[i].trainIdx ].pt );
  }
  
  /* Find Homography */
  Mat H = findHomography( Mat(points2), Mat(points1), CV_RANSAC );
  
  /* warp the image */
  warpPerspective(mImg2, warpImage2, H, Size(mImg2.cols*2, mImg2.rows*2), INTER_CUBIC);
  </code></pre>
  
  <p>and I need to stitch <code>Mat mImg1</code> where is loaded the first image and <code>Mat warpImage2</code> where is the warped second image. Can you pls show me how to do that? I also have the warped image cut up and I know I have to change the homography matrix but for now I need to align these two images. Thank you for helping. </p>
  
  <p>Edit: With Martin Beckett's help I added this code</p>
  
  <pre><code>//Point a cv::Mat header at it (no allocation is done)
  Mat final(Size(mImg2.cols*2 + mImg1.cols, mImg2.rows*2),CV_8UC3);
  
  //velikost img1
  Mat roi1(final, Rect(0, 0,  mImg1.cols, mImg1.rows));
  Mat roi2(final, Rect(0, 0, warpImage2.cols, warpImage2.rows));
  warpImage2.copyTo(roi2);
  mImg1.copyTo(roi1);
  imshow("final", final);
  </code></pre>
  
  <p>and it's working now</p>