test_roadgen3d.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:derplearning 作者: John-Ellis 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号