original_docstring:  Takes an object and a projection matrix (P) and projects the 3d
          bounding box into the image plane.
          Returns:
              corners_2d: (8,2) array in left image coord.
              corners_3d: (8,3) array in in rect camera coord.
      
docstring: Takes an object and a projection matrix (P) and projects the 3d
  bounding box into the image plane.
docstring_tokens: Takes an object and a projection matrix ( P ) and projects the 3d bounding box into the image plane .
code: def compute_box_3d(obj, P=None):
      ''' Takes an object and a projection matrix (P) and projects the 3d
          bounding box into the image plane.
          Returns:
              corners_2d: (8,2) array in left image coord.
              corners_3d: (8,3) array in in rect camera coord.
      '''
      # compute rotational matrix around yaw axis
      R = roty(obj.ry)
      # 3d bounding box dimensions
      l = obj.l
      w = obj.w
      h = obj.h
      # 3d bounding box corners
      x_corners = [l / 2, l / 2, -l / 2, -l / 2, l / 2, l / 2, -l / 2, -l / 2]
      y_corners = [0, 0, 0, 0, -h, -h, -h, -h]
      z_corners = [w / 2, -w / 2, -w / 2, w / 2, w / 2, -w / 2, -w / 2, w / 2]
      # rotate and translate 3d bounding box
      corners_3d = np.dot(R, np.vstack([x_corners, y_corners, z_corners]))
      # print corners_3d.shape
      corners_3d[0, :] = corners_3d[0, :] + obj.t[0]
      corners_3d[1, :] = corners_3d[1, :] + obj.t[1]
      corners_3d[2, :] = corners_3d[2, :] + obj.t[2]
      # print 'cornsers_3d: ', corners_3d
      # only draw 3d bounding box for objs in front of the camera
      # if np.any(corners_3d[2, :] < 0.1):
      #     corners_2d = None
      #     return corners_2d, np.transpose(corners_3d)
      # project the 3d bounding box into the image plane
      if P is None:
          corners_2d = None
          return corners_2d, np.transpose(corners_3d)
      corners_2d = project_to_image(np.transpose(corners_3d), P)
      # print 'corners_2d: ', corners_2d
      return corners_2d, np.transpose(corners_3d)
code_tokens: def compute_box_3d ( obj , P = None ) : R = roty ( obj . ry ) l = obj . l w = obj . w h = obj . h x_corners = [ l / 2 , l / 2 , - l / 2 , - l / 2 , l / 2 , l / 2 , - l / 2 , - l / 2 ] y_corners = [ 0 , 0 , 0 , 0 , - h , - h , - h , - h ] z_corners = [ w / 2 , - w / 2 , - w / 2 , w / 2 , w / 2 , - w / 2 , - w / 2 , w / 2 ] corners_3d = np . dot ( R , np . vstack ( [ x_corners , y_corners , z_corners ] ) ) corners_3d [ 0 , : ] = corners_3d [ 0 , : ] + obj . t [ 0 ] corners_3d [ 1 , : ] = corners_3d [ 1 , : ] + obj . t [ 1 ] corners_3d [ 2 , : ] = corners_3d [ 2 , : ] + obj . t [ 2 ] if P is None : corners_2d = None return corners_2d , np . transpose ( corners_3d ) corners_2d = project_to_image ( np . transpose ( corners_3d ) , P ) return corners_2d , np . transpose ( corners_3d )
short_docstring: Takes an object and a projection matrix (P) and projects the 3d
  bounding box into the image plane.
short_docstring_tokens: Takes an object and a projection matrix ( P ) and projects the 3d bounding box into the image plane .
comment: ''' Takes an object and a projection matrix (P) and projects the 3d
          bounding box into the image plane.
          Returns:
              corners_2d: (8,2) array in left image coord.
              corners_3d: (8,3) array in in rect camera coord.
      '''$SEP$# compute rotational matrix around yaw axis$SEP$# 3d bounding box dimensions$SEP$# 3d bounding box corners$SEP$# rotate and translate 3d bounding box$SEP$# print corners_3d.shape$SEP$# print 'cornsers_3d: ', corners_3d$SEP$# only draw 3d bounding box for objs in front of the camera$SEP$# if np.any(corners_3d[2, :] < 0.1):$SEP$#     corners_2d = None$SEP$#     return corners_2d, np.transpose(corners_3d)$SEP$# project the 3d bounding box into the image plane$SEP$# print 'corners_2d: ', corners_2d