def test_clone_look_at(self): pp = EigenArray.from_iterable([300, 400]) k = CameraIntrinsics(1000, pp) focus = EigenArray.from_iterable([0, 1, -2]) base = Camera([3, -4, 7], Rotation(), k) cam = base.clone_look_at(focus) nose.tools.assert_not_equal(base, cam) ifocus = cam.project(focus) nose.tools.assert_almost_equal(numpy.linalg.norm(ifocus - pp, 2), 0., 12) ifocus_up = cam.project(focus + EigenArray.from_iterable([0, 0, 2])) tmp = ifocus_up - pp nose.tools.assert_almost_equal(tmp[0], 0., 12) nose.tools.assert_true(tmp[1] < 0.)
def test_clone_look_at(self): pp = EigenArray.from_array([[300], [400]]) k = CameraIntrinsics(1000, [300, 400]) focus = EigenArray.from_array([[0], [1], [-2]]) center = EigenArray.from_array([[3],[-4],[7]]) base = Camera(center, Rotation(), k) cam = base.clone_look_at(numpy.array([0,1,2])) nose.tools.assert_not_equal(base, cam) ifocus = cam.project([0,1,2]) nose.tools.assert_almost_equal(numpy.linalg.norm(ifocus - pp.get_matrix().T, 2), 0., 12) ifocus_up = cam.project([0,1,4]) tmp = (ifocus_up - pp.get_matrix().T)[0] nose.tools.assert_almost_equal(tmp[0], 0., 12) nose.tools.assert_true(tmp[1] < 0.)
def test_clone_look_at(self): pp = EigenArray.from_array([[300], [400]]) k = CameraIntrinsics(1000, [300, 400]) focus = EigenArray.from_array([[0], [1], [-2]]) center = EigenArray.from_array([[3], [-4], [7]]) base = Camera(center, Rotation(), k) cam = base.clone_look_at(numpy.array([0, 1, 2])) nose.tools.assert_not_equal(base, cam) ifocus = cam.project([0, 1, 2]) nose.tools.assert_almost_equal( numpy.linalg.norm(ifocus - pp.get_matrix().T, 2), 0., 12) ifocus_up = cam.project([0, 1, 4]) tmp = (ifocus_up - pp.get_matrix().T)[0] nose.tools.assert_almost_equal(tmp[0], 0., 12) nose.tools.assert_true(tmp[1] < 0.)