Example #1
0
    def normalize_input(self, pc, pred_box_center, pred_box_angle, gt_box_center=None, gt_box_angle=None):
        # translate center to reference point
        # rotate coordinate to reference angle
        ref_center = pred_box_center
        rot_angle = pred_box_angle

        pc = pc - ref_center
        pc = rotate_pc_along_y(pc, rot_angle)
        if gt_box_center is not None and gt_box_angle is not None:
            gt_box_center = gt_box_center - ref_center
            gt_box_angle = gt_box_angle - pred_box_angle
            gt_box_center = rotate_pc_along_y(gt_box_center[np.newaxis, :], rot_angle).squeeze(0)

        return pc, gt_box_center, gt_box_angle
Example #2
0
    def get_center_view_box3d(self, box3d_center, box3d_angle, ref_center, ref_angle):

        box3d_center = box3d_center - ref_center
        box3d_angle = box3d_angle - ref_angle
        box3d_center = rotate_pc_along_y(box3d_center[np.newaxis, :], ref_angle).squeeze(0)

        return box3d_center, box3d_angle
 def get_center_view(self, point_set, frustum_angle):
     ''' Frustum rotation of point clouds.
     NxC points with first 3 channels as XYZ
     z is facing forward, x is left ward, y is downward
     '''
     # Use np.copy to avoid corrupting original data
     point_set = np.copy(point_set)
     return rotate_pc_along_y(point_set, self.get_center_view_rot_angle(frustum_angle))
Example #4
0
def from_prediction_to_label_format(center, angle, size, rot_angle, ref_center):
    ''' Convert predicted box parameters to label format. '''
    l, w, h = size
    ry = angle + rot_angle
    tx, ty, tz = rotate_pc_along_y(np.expand_dims(center, 0), -rot_angle).squeeze()
    tx = tx + ref_center[0]
    ty = ty + ref_center[1]
    tz = tz + ref_center[2]
    ty += h / 2.0
    return h, w, l, tx, ty, tz, ry
 def get_center_view_box3d(self, index):
     ''' Frustum rotation of 3D bounding box corners. '''
     box3d = self.box3d_list[index]
     box3d_center_view = np.copy(box3d)
     return rotate_pc_along_y(box3d_center_view,
                              self.get_center_view_rot_angle(index))
 def get_center_view_box3d_center(self, index):
     ''' Frustum rotation of 3D bounding box center. '''
     box3d_center = (self.box3d_list[index][0, :] +
                     self.box3d_list[index][6, :]) / 2.0
     return rotate_pc_along_y(np.expand_dims(
         box3d_center, 0), self.get_center_view_rot_angle(index)).squeeze()
    def get_center_view_point(self, point, ref_center, ref_angle):

        point = point - ref_center
        point = rotate_pc_along_y(point, ref_angle)

        return point
Example #8
0
 def get_center_view_box3d(self, box3d, frustum_angle):
     ''' Frustum rotation of 3D bounding box corners. '''
     box3d = box3d
     box3d_center_view = np.copy(box3d)
     return rotate_pc_along_y(box3d_center_view,
                              self.get_center_view_rot_angle(frustum_angle))
Example #9
0
 def get_center_view_box3d_center(self, box3d, frustum_angle):
     ''' Frustum rotation of 3D bounding box center. '''
     box3d_center = (box3d[0, :] + box3d[6, :]) / 2.0
     return rotate_pc_along_y(
         np.expand_dims(box3d_center, 0),
         self.get_center_view_rot_angle(frustum_angle)).squeeze()