add python binding and tests for composePanorama
authordanielenricocahall <danielenricocahall@gmail.com>
Sun, 2 Aug 2020 20:12:13 +0000 (16:12 -0400)
committerdanielenricocahall <danielenricocahall@gmail.com>
Sun, 2 Aug 2020 23:29:16 +0000 (19:29 -0400)
fix tests

    pick 54039c2afd add python binding and tests for composePanorama

modules/stitching/include/opencv2/stitching.hpp
modules/stitching/misc/python/test/test_stitching.py

index 07e1b5f73a42dff0647d5b81c3a520f9b44e015b..52789156b8821d275a8c5047e4b62f40a1db23af 100644 (file)
@@ -264,7 +264,7 @@ public:
     @param pano Final pano.
     @return Status code.
      */
-    Status composePanorama(InputArrayOfArrays images, OutputArray pano);
+    CV_WRAP Status composePanorama(InputArrayOfArrays images, OutputArray pano);
 
     /** @overload */
     CV_WRAP Status stitch(InputArrayOfArrays images, OutputArray pano);
index 3a5a99a59030942f6eaecfb0de6623de9767b9b3..e6fbf9ad0b19c514ee1cdffef8f90dd22a14f99d 100644 (file)
@@ -19,5 +19,36 @@ class stitching_test(NewOpenCVTests):
         self.assertAlmostEqual(pano.shape[0], 685, delta=100, msg="rows: %r" % list(pano.shape))
         self.assertAlmostEqual(pano.shape[1], 1025, delta=100, msg="cols: %r" % list(pano.shape))
 
+
+class stitching_compose_panorama_test_no_args(NewOpenCVTests):
+
+    def test_simple(self):
+
+        img1 = self.get_sample('stitching/a1.png')
+        img2 = self.get_sample('stitching/a2.png')
+
+        stitcher = cv.createStitcher(False)
+
+        stitcher.estimateTransform((img1, img2))
+
+        result, _ = stitcher.composePanorama()
+
+        assert result == 0
+
+
+class stitching_compose_panorama_args(NewOpenCVTests):
+
+    def test_simple(self):
+
+        img1 = self.get_sample('stitching/a1.png')
+        img2 = self.get_sample('stitching/a2.png')
+
+        stitcher = cv.createStitcher(False)
+
+        stitcher.estimateTransform((img1, img2))
+        result, _ = stitcher.composePanorama((img1, img2))
+
+        assert result == 0
+
 if __name__ == '__main__':
     NewOpenCVTests.bootstrap()