test_stitcher.cpp 1.1 KB

12345678910111213141516171819202122232425262728
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #include "test_precomp.hpp"
  5. namespace opencv_test { namespace {
  6. TEST(ImageStitcher, setTransform)
  7. {
  8. vector<Mat> images;
  9. images.push_back(imread(string(cvtest::TS::ptr()->get_data_path()) + "stitching/s1.jpg"));
  10. images.push_back(imread(string(cvtest::TS::ptr()->get_data_path()) + "stitching/s2.jpg"));
  11. Mat expected;
  12. Ptr<Stitcher> stitcher = Stitcher::create(Stitcher::PANORAMA);
  13. EXPECT_TRUE(Stitcher::OK == stitcher->estimateTransform(images));
  14. EXPECT_TRUE(Stitcher::OK == stitcher->composePanorama(expected));
  15. Mat result;
  16. Ptr<Stitcher> another_stitcher = Stitcher::create(Stitcher::PANORAMA);
  17. EXPECT_TRUE(Stitcher::OK == another_stitcher->setTransform(images, stitcher->cameras()));
  18. EXPECT_TRUE(Stitcher::OK == another_stitcher->composePanorama(result));
  19. EXPECT_DOUBLE_EQ(cvtest::norm(expected, result, NORM_INF), .0);
  20. }
  21. }} // namespace opencv_test