parameters: (reconstruction, no_cameras=False, no_points=False)
return_statement: return '\n'.join(header + vertices + [''])
docstring: Export reconstruction points as a PLY string.
docstring_summary: Export reconstruction points as a PLY string.
docstring_tokens: Export reconstruction points as a PLY string .
function: def reconstruction_to_ply(reconstruction, no_cameras=False, no_points=False):
      """Export reconstruction points as a PLY string."""
      vertices = []
  
      if not no_points:
          for point in reconstruction.points.values():
              p, c = point.coordinates, point.color
              s = "{} {} {} {} {} {}".format(
                  p[0], p[1], p[2], int(c[0]), int(c[1]), int(c[2]))
              vertices.append(s)
  
      if not no_cameras:
          for shot in reconstruction.shots.values():
              o = shot.pose.get_origin()
              R = shot.pose.get_rotation_matrix()
              for axis in range(3):
                  c = 255 * np.eye(3)[axis]
                  for depth in np.linspace(0, 2, 10):
                      p = o + depth * R[axis]
                      s = "{} {} {} {} {} {}".format(
                          p[0], p[1], p[2], int(c[0]), int(c[1]), int(c[2]))
                      vertices.append(s)
  
      header = [
          "ply",
          "format ascii 1.0",
          "element vertex {}".format(len(vertices)),
          "property float x",
          "property float y",
          "property float z",
          "property uchar diffuse_red",
          "property uchar diffuse_green",
          "property uchar diffuse_blue",
          "end_header",
      ]
  
      return '\n'.join(header + vertices + [''])
function_tokens: def reconstruction_to_ply ( reconstruction , no_cameras = False , no_points = False ) : vertices = [ ] if not no_points : for point in reconstruction . points . values ( ) : p , c = point . coordinates , point . color s = "{} {} {} {} {} {}" . format ( p [ 0 ] , p [ 1 ] , p [ 2 ] , int ( c [ 0 ] ) , int ( c [ 1 ] ) , int ( c [ 2 ] ) ) vertices . append ( s ) if not no_cameras : for shot in reconstruction . shots . values ( ) : o = shot . pose . get_origin ( ) R = shot . pose . get_rotation_matrix ( ) for axis in range ( 3 ) : c = 255 * np . eye ( 3 ) [ axis ] for depth in np . linspace ( 0 , 2 , 10 ) : p = o + depth * R [ axis ] s = "{} {} {} {} {} {}" . format ( p [ 0 ] , p [ 1 ] , p [ 2 ] , int ( c [ 0 ] ) , int ( c [ 1 ] ) , int ( c [ 2 ] ) ) vertices . append ( s ) header = [ "ply" , "format ascii 1.0" , "element vertex {}" . format ( len ( vertices ) ) , "property float x" , "property float y" , "property float z" , "property uchar diffuse_red" , "property uchar diffuse_green" , "property uchar diffuse_blue" , "end_header" , ] return '\n' . join ( header + vertices + [ '' ] )