test_PinholeCamera.py
Go to the documentation of this file.
1 """
2 GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
4 All Rights Reserved
5 
6 See LICENSE for the license information
7 
8 PinholeCamera unit tests.
9 Author: Fan Jiang
10 """
11 import unittest
12 from math import pi
13 
14 import numpy as np
15 
16 import gtsam
17 from gtsam.utils.test_case import GtsamTestCase
18 
19 
21  """
22  Tests if we can correctly get the camera Jacobians in Python
23  """
24  def test_jacobian(self):
26 
27  # order is important because Eigen is column major!
28  Dpose = np.zeros((2, 6), order='F')
29  Dpoint = np.zeros((2, 3), order='F')
30  Dcal = np.zeros((2, 3), order='F')
31  cam1.project(np.array([1, 1, 1]), Dpose, Dpoint, Dcal)
32 
33  self.gtsamAssertEquals(Dpoint, np.array([[1, 0, -1], [0, 1, -1]]))
34 
35  self.gtsamAssertEquals(
36  Dpose,
37  np.array([
38  [1., -2., 1., -1., 0., 1.], #
39  [2., -1., -1., 0., -1., 1.]
40  ]))
41 
42  self.gtsamAssertEquals(Dcal, np.array([[1., 2., 4.], [1., 2., 4.]]))
43 
44 
45 if __name__ == "__main__":
46  unittest.main()
test_PinholeCamera.TestPinholeCamera
Definition: test_PinholeCamera.py:20
gtsam::utils.test_case.GtsamTestCase.gtsamAssertEquals
def gtsamAssertEquals(self, actual, expected, tol=1e-9)
Definition: test_case.py:18
test_PinholeCamera.TestPinholeCamera.test_jacobian
def test_jacobian(self)
Definition: test_PinholeCamera.py:24
gtsam::PinholeCamera
Definition: PinholeCamera.h:33
gtsam::utils.test_case
Definition: test_case.py:1
gtsam::utils.test_case.GtsamTestCase
Definition: test_case.py:15


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:05