title: Cannot stitch many images using Stitcher class in opencv c++
body: <p>I want to stitch many images ( 25 ) in one single image of a straight surface of plastic part. Images look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/jLJNr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jLJNr.png" alt="enter image description here"></a>  <a href="https://i.stack.imgur.com/aqQ49.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aqQ49.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/8PsIa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8PsIa.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/TYa5J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TYa5J.png" alt="enter image description here"></a></p>
  
  <p>I am trying to use the Stitcher class form opencv. My code is here:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include "opencv2/highgui/highgui.hpp"
  #include &lt;opencv2/stitching.hpp&gt;
  
  using namespace std;
  using namespace cv;
  
  bool try_use_gpu = false;
  vector&lt;Mat&gt; imgs;
  string result_name = "result.jpg";
  Mat img1, img2,img3,img4,img5,img6,img7, pano;
  
  void printUsage();
  //int parseCmdArgs(int argc, char** argv);
  
  int main(int argc, char* argv[])
  {
      // Load images from HD.
      img1 = imread("1.bmp");
      img2 = imread("2.bmp");
      img3 = imread("3.bmp");
      img4 = imread("4.bmp"); 
  
      // Put images into vector of images "imgs".
      imgs.push_back(img1);
      imgs.push_back(img2);
      imgs.push_back(img3);
      imgs.push_back(img4);   
  
      // Create stitcher instance and use stitch method with imgs.
      Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
      stitcher.setPanoConfidenceThresh(0.8);
      Stitcher::Status status = stitcher.stitch(imgs, pano);
  
      if (status != Stitcher::OK)
      {
          cout &lt;&lt; "Can't stitch images, error code = " &lt;&lt; status &lt;&lt; endl;
          return -1;
      }
  
      imwrite(result_name, pano);
  
      return 0;
  }
  </code></pre>
  
  <p>I Always get an error saying : "Can't stitch images, error code = 1" so the system is saying that it needs more images. When debugging I see that images are properly loaded and then, vector imgs properly created. What can be the reasons? My calcuclation also last quite long (2 s)...</p>