def test_computehomography2(self): '''Tests A matrix from TODO 2''' # Place holder to get A from computeHomography A_student = np.zeros((8, 9)) alignment.computeHomography(self.f1, self.f2, self.matches, A_student) A_soln = np.load('testMat/identityA.npy') self.assertTrue(np.allclose(A_soln, A_student, rtol=1e-05, atol=1e-05), 'Error in Filling in A Matrix')
def test_computehomography3(self): '''Tests A matrix from TODO 3''' H_student = alignment.computeHomography(self.f1, self.f2, self.matches) H_student = H_student.astype(float) H_student = H_student / H_student[2, 2] self.assertTrue( np.allclose(np.eye(3), H_student, rtol=1e-05, atol=1e-05), 'Error in Computing Homography')
def testComputeHomography1(self): f1 = [] f2 = [] f1.append(cv2.KeyPoint(x=2,y=2,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) f1.append(cv2.KeyPoint(x=5,y=2,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) f1.append(cv2.KeyPoint(x=4,y=4,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) f1.append(cv2.KeyPoint(x=2,y=5,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) f2.append(cv2.KeyPoint(x=2,y=2,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) f2.append(cv2.KeyPoint(x=5,y=2,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) f2.append(cv2.KeyPoint(x=4,y=4,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) f2.append(cv2.KeyPoint(x=2,y=5,_size=2,_angle=0,_response=0,_octave=0,_class_id=0)) matches = [] for i in range(4): matches.append(cv2.DMatch(i,i,0.0)) print alignment.computeHomography(f1, f2, matches)