parameters: (spherical_shot, width)
return_statement: return shots
docstring: Create 6 perspective views of a panorama.
docstring_summary: Create 6 perspective views of a panorama.
docstring_tokens: Create 6 perspective views of a panorama .
function: def perspective_views_of_a_panorama(spherical_shot, width):
      """Create 6 perspective views of a panorama."""
      camera = types.PerspectiveCamera()
      camera.id = 'perspective_panorama_camera'
      camera.width = width
      camera.height = width
      camera.focal = 0.5
      camera.focal_prior = camera.focal
      camera.k1 = camera.k1_prior = camera.k2 = camera.k2_prior = 0.0
  
      names = ['front', 'left', 'back', 'right', 'top', 'bottom']
      rotations = [
          tf.rotation_matrix(-0 * np.pi / 2, (0, 1, 0)),
          tf.rotation_matrix(-1 * np.pi / 2, (0, 1, 0)),
          tf.rotation_matrix(-2 * np.pi / 2, (0, 1, 0)),
          tf.rotation_matrix(-3 * np.pi / 2, (0, 1, 0)),
          tf.rotation_matrix(-np.pi / 2, (1, 0, 0)),
          tf.rotation_matrix(+np.pi / 2, (1, 0, 0)),
      ]
      shots = []
      for name, rotation in zip(names, rotations):
          shot = types.Shot()
          shot.id = '{}_perspective_view_{}'.format(spherical_shot.id, name)
          shot.camera = camera
          R = np.dot(rotation[:3, :3], spherical_shot.pose.get_rotation_matrix())
          o = spherical_shot.pose.get_origin()
          shot.pose = types.Pose()
          shot.pose.set_rotation_matrix(R)
          shot.pose.set_origin(o)
          shots.append(shot)
      return shots
function_tokens: def perspective_views_of_a_panorama ( spherical_shot , width ) : camera = types . PerspectiveCamera ( ) camera . id = 'perspective_panorama_camera' camera . width = width camera . height = width camera . focal = 0.5 camera . focal_prior = camera . focal camera . k1 = camera . k1_prior = camera . k2 = camera . k2_prior = 0.0 names = [ 'front' , 'left' , 'back' , 'right' , 'top' , 'bottom' ] rotations = [ tf . rotation_matrix ( - 0 * np . pi / 2 , ( 0 , 1 , 0 ) ) , tf . rotation_matrix ( - 1 * np . pi / 2 , ( 0 , 1 , 0 ) ) , tf . rotation_matrix ( - 2 * np . pi / 2 , ( 0 , 1 , 0 ) ) , tf . rotation_matrix ( - 3 * np . pi / 2 , ( 0 , 1 , 0 ) ) , tf . rotation_matrix ( - np . pi / 2 , ( 1 , 0 , 0 ) ) , tf . rotation_matrix ( + np . pi / 2 , ( 1 , 0 , 0 ) ) , ] shots = [ ] for name , rotation in zip ( names , rotations ) : shot = types . Shot ( ) shot . id = '{}_perspective_view_{}' . format ( spherical_shot . id , name ) shot . camera = camera R = np . dot ( rotation [ : 3 , : 3 ] , spherical_shot . pose . get_rotation_matrix ( ) ) o = spherical_shot . pose . get_origin ( ) shot . pose = types . Pose ( ) shot . pose . set_rotation_matrix ( R ) shot . pose . set_origin ( o ) shots . append ( shot ) return shots