src/tools/benchmark_tool/benchmark_tool/kittiobjdetsdk/kitti_obj_detection_utils.py
def transform_velodyne_to_camera_frame(points_3d, calibration_matrices):
        """
        Transform the provided 3d points from velodyne to camera-rectified reference frame.

        @param points_3d: The point in 3d space to be transform
        @type  points_3d: numpy array 3xN
        @param calibration_matrices: The calibration matrices dictionary
        @type  calibration_matrices: dict
        @return: numpy array 3xN
        """
        assert (points_3d.shape[0] == 3)
        # (3xn) => (4xn)
        n = points_3d.shape[1]
        ones = np.ones((1, n))
        points_3d = np.vstack([points_3d[0, :], points_3d[1, :],
                               points_3d[2, :], ones])

        # Velo to cam matrix
        v2c = calibration_matrices["Tr_velo_to_cam"]  # 3x4
        v2c = np.vstack([v2c[0, :], v2c[1, :], v2c[2, :], np.zeros((1, 4))])  # 4x4
        v2c[3, 3] = 1

        # Rect image
        R0_rect = calibration_matrices["R0_rect"]  # 3x3
        R0_rect = np.vstack([R0_rect[0, :], R0_rect[1, :], R0_rect[2, :],
                             np.zeros((1, 3))])  # 4x3
        R0_rect = np.hstack((R0_rect, np.zeros((4, 1))))  # 4x4
        R0_rect[3, 3] = 1

        # velo_to_cam dot pointcloud_ref_frame
        intermediate = np.dot(v2c, points_3d)  # 4x4 dot 4xn = 4xn

        # R0_rect dot (velo_to_cam dot pointcloud_ref_frame)
        intermediate = np.dot(R0_rect, intermediate)  # 4x4 dot 4xn = 4xn

        intermediate = np.vstack([intermediate[0, :], intermediate[1, :],
                                  intermediate[2, :]])  # 3xn

        return intermediate

        Transform the provided 3d points from velodyne to camera-rectified reference frame.

        @param points_3d: The point in 3d space to be transform
        @type  points_3d: numpy array 3xN
        @param calibration_matrices: The calibration matrices dictionary
        @type  calibration_matrices: dict
        @return: numpy array 3xN
        
Transform the provided 3d points from velodyne to camera-rectified reference frame.
Transform the provided 3d points from velodyne to camera - rectified reference frame .
def transform_velodyne_to_camera_frame(points_3d, calibration_matrices):
        assert (points_3d.shape[0] == 3)
        n = points_3d.shape[1]
        ones = np.ones((1, n))
        points_3d = np.vstack([points_3d[0, :], points_3d[1, :],
                               points_3d[2, :], ones])
        v2c = calibration_matrices["Tr_velo_to_cam"]  
        v2c = np.vstack([v2c[0, :], v2c[1, :], v2c[2, :], np.zeros((1, 4))])  
        v2c[3, 3] = 1
        R0_rect = calibration_matrices["R0_rect"]  
        R0_rect = np.vstack([R0_rect[0, :], R0_rect[1, :], R0_rect[2, :],
                             np.zeros((1, 3))])  
        R0_rect = np.hstack((R0_rect, np.zeros((4, 1))))  
        R0_rect[3, 3] = 1
        intermediate = np.dot(v2c, points_3d)   dot 4xn = 4xn
        intermediate = np.dot(R0_rect, intermediate)   dot 4xn = 4xn
        intermediate = np.vstack([intermediate[0, :], intermediate[1, :],
                                  intermediate[2, :]])  
        return intermediate
def transform_velodyne_to_camera_frame ( points_3d , calibration_matrices ) : assert ( points_3d . shape [ 0 ] == 3 ) n = points_3d . shape [ 1 ] ones = np . ones ( ( 1 , n ) ) points_3d = np . vstack ( [ points_3d [ 0 , : ] , points_3d [ 1 , : ] , points_3d [ 2 , : ] , ones ] ) v2c = calibration_matrices [ "Tr_velo_to_cam" ] v2c = np . vstack ( [ v2c [ 0 , : ] , v2c [ 1 , : ] , v2c [ 2 , : ] , np . zeros ( ( 1 , 4 ) ) ] ) v2c [ 3 , 3 ] = 1 R0_rect = calibration_matrices [ "R0_rect" ] R0_rect = np . vstack ( [ R0_rect [ 0 , : ] , R0_rect [ 1 , : ] , R0_rect [ 2 , : ] , np . zeros ( ( 1 , 3 ) ) ] ) R0_rect = np . hstack ( ( R0_rect , np . zeros ( ( 4 , 1 ) ) ) ) R0_rect [ 3 , 3 ] = 1 intermediate = np . dot ( v2c , points_3d ) intermediate = np . dot ( R0_rect , intermediate ) intermediate = np . vstack ( [ intermediate [ 0 , : ] , intermediate [ 1 , : ] , intermediate [ 2 , : ] ] ) return intermediate
Transform the provided 3d points from velodyne to camera-rectified reference frame.
Transform the provided 3d points from velodyne to camera - rectified reference frame .
"""
        Transform the provided 3d points from velodyne to camera-rectified reference frame.

        @param points_3d: The point in 3d space to be transform
        @type  points_3d: numpy array 3xN
        @param calibration_matrices: The calibration matrices dictionary
        @type  calibration_matrices: dict
        @return: numpy array 3xN
        """ # (3xn) => (4xn) # Velo to cam matrix # 3x4 # 4x4 # Rect image # 3x3 # 4x3 # 4x4 # velo_to_cam dot pointcloud_ref_frame # 4x4 dot 4xn = 4xn # R0_rect dot (velo_to_cam dot pointcloud_ref_frame) # 4x4 dot 4xn = 4xn # 3xn
numpy array 3xN
numpy array 3xN
points_3d
The point in 3d space to be transform
The point in 3d space to be transform
calibration_matrices
The calibration matrices dictionary
The calibration matrices dictionary