title: Stitching 2 images with overlapping area using opencv
body: <p>I want to stitch 2 images using opencv(i don't want to use stitcher class), so far i've done keypoint detection, description, matching and warping</p>
  
  <p>there are input images:</p>
  
  <p><a href="https://i.stack.imgur.com/lurDG.jpg" rel="nofollow noreferrer">left</a>
  <a href="https://i.stack.imgur.com/pGgmg.jpg" rel="nofollow noreferrer">right</a></p>
  
  <p><a href="https://i.stack.imgur.com/LZEDq.jpg" rel="nofollow noreferrer">myOutput</a></p>
  
  <p><a href="https://i.stack.imgur.com/vcG4x.jpg" rel="nofollow noreferrer">stitcherClassOutput</a></p>
  
  <p>here is my code after finding good matches with surf algorithm:</p>
  
  <pre><code>for (int j = 0; j &lt; good_matches.size(); j++)
  {
      //-- Get the keypoints from the good matches
      obj.push_back(keypoints1[good_matches[j].queryIdx].pt);
      scene.push_back(keypoints2[good_matches[j].trainIdx].pt);
  }
  
  H = findHomography(Mat(scene), Mat(obj),match_mask, CV_RANSAC);
  
  
  cv::Mat result;
  warpPerspective(image2, result, H, cv::Size(image2.cols + image1.cols, image2.rows*2), INTER_CUBIC);
  
  Mat final(Size(image2.cols * 2 + image2.cols, image2.rows * 2), CV_8UC3);
  
  Mat roi1(final, Rect(0, 0, image1.cols, image1.rows));
  Mat roi2(final, Rect(0, 0, result.cols, result.rows));
  
  result.copyTo(roi2);
  image1.copyTo(roi1);
  
  imshow("Result", final);
  </code></pre>
  
  <p>so my question is, what should i add to my code for my output to look more like the one from stitcher class</p>