2

我正在使用 OpenCV 来执行此操作。 代码

  Mat img1 = imread("test\\test\\1_1.jpg");
  Mat img2 = imread("test\\test\\1_2.jpg");
  Mat img3 = imread("test\\test\\1_3.jpg");

  if (!img3.data)                              // Check for invalid input
  {
      cout << "Could not open or find the image" << std::endl;
      return -1;
  }
  imgs.push_back(img1);
  imgs.push_back(img2);
  imgs.push_back(img3);


  Mat pano;
  Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
  stitcher.setRegistrationResol(0.6);
  stitcher.setSeamEstimationResol(0.1);
  stitcher.setPanoConfidenceThresh(1);
  stitcher.setWaveCorrection(true);
  stitcher.setFeaturesMatcher(new detail::BestOf2NearestMatcher(try_use_gpu));
  stitcher.setBundleAdjuster(new detail::BundleAdjusterRay());

  cout<<stitcher.seamEstimationResol()<<endl;

  cout << stitcher.registrationResol() << endl;
  cout << stitcher.compositingResol() << endl;

  Stitcher::Status status = stitcher.stitch(imgs, pano);

  if (status != Stitcher::OK)
  {
      cout << "Can't stitch images, error code = " << status << endl;
      //return -1;
  }
  namedWindow("wind",0);
  imshow("wind", pano);
  imwrite(result_name, pano);
  waitKey(0);
  return 0;

}

结果就像 result.jpg。它没有给出正确的拼接质量。

谁能指导我如何提高质量?

4

0 回答 0