def test_cart2Spherical(self):
four_corners3d_mm = np.zeros( (4, 3) )
four_corners3d_mm[:, 0] = self.four_corners_mm[1, :]
four_corners3d_mm[:, 1] = -self.four_corners_mm[0, :]
four_corners3d_mm[:, 2] = self.test0.cam_height
four_corners_angles = np.zeros( (4, 2) )
four_corners_angles[:, 1] = [self.test0.cam_arc_x/2, -self.test0.cam_arc_x/2,
-self.test0.cam_arc_x/2, self.test0.cam_arc_x/2 ]
four_corners_angles[:, 0] = [np.pi/2 - self.test0.cam_vlim_crop_y,
np.pi/2 - self.test0.cam_vlim_crop_y,
np.pi/2 - self.test0.cam_to_ground_arc,
self.test0.cam_tilt_y - self.test0.cam_arc_y]
npt.assert_almost_equal(self.test0.cart2Spherical(np.array([[1,0,0]]) ), [[1, 0, 0]])
npt.assert_almost_equal(self.test0.cart2Spherical(
np.array([[0,0,2]]) ), [[2, np.pi/2, 0]], decimal=4)
npt.assert_almost_equal(self.test0.cart2Spherical(
np.array([[0,2,0]]) ), [[2, 0, np.pi/2]], decimal=4)
npt.assert_almost_equal(self.test0.cart2Spherical( four_corners3d_mm )[:,1:], four_corners_angles, decimal=4)
#checks to make sure the named function generates the appropriate rotational matrix
评论列表
文章目录