Commit 7ae7189e authored by kberry's avatar kberry
Browse files

shell of calculating homography functionality; update matcher to return a...

shell of calculating homography functionality; update matcher to return a tuple; update matcher tests so they don't fail
parent 6a5a9c68
Loading
Loading
Loading
Loading

autocnet/homography.py

0 → 100644
+7 −0
Original line number Diff line number Diff line
#imports
import cv2

#define our one function. add documentation.
def calculate_homography(src_points, des_points, outlier_algorithm=cv2.RANSAC):
    cv2.calculateHomography(src_points, des_points, outlier_algorithm, 5.0)
+2 −1
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ class FlannMatcher(object):
                                i.queryIdx,
                                i.trainIdx,
                                i.distance))
        return pd.DataFrame(matched, columns=['matched_to', 'queryIdx',
        data_frame = pd.DataFrame(matched, columns=['matched_to', 'queryIdx',
                                              'trainIdx', 'distance'])
        return matches, data_frame
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class TestMatcher(unittest.TestCase):

        fmatcher.train()

        matched = fmatcher.query(self.fd['AS15-M-0296_SML.png'][1], k=2)
        ignoreme, matched = fmatcher.query(self.fd['AS15-M-0296_SML.png'][1], k=2)
        self.assertEqual(10, len(matched))

        # Check that self neighbors are being omitted
@@ -56,7 +56,7 @@ class TestMatcher(unittest.TestCase):

        fmatcher.train()

        matched = fmatcher.query(self.fd['AS15-M-0296_SML.png'][1], k=3)
        ignoreme, matched = fmatcher.query(self.fd['AS15-M-0296_SML.png'][1], k=3)
        self.assertEqual(20, len(matched))

        # Check that self neighbors are being omitted
+12 −0
Original line number Diff line number Diff line
import unittest

class TestCalculateHomography(unittest.TestCase):
    def setUp(self):
        self.src_points = ""
        self.des_points = ""

    def test_compute_homography(self):
        self.assertEqual(self.src_points, self.des_points)

    def tearDown(self):
        print(False)
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ class TestTwoImageMatching(unittest.TestCase):

        for node, attributes in cg.nodes_iter(data=True):
            descriptors = attributes['descriptors']
            matches = fl.query(descriptors, k=2)
            ignoreme, matches = fl.query(descriptors, k=2)
            cg.add_matches(node, matches)

        # Step: And create a C object