export_ply_example.py
Go to the documentation of this file.
1 ## License: Apache 2.0. See LICENSE file in root directory.
2 ## Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 
4 #####################################################
5 ## Export to PLY ##
6 #####################################################
7 
8 # First import the library
9 import pyrealsense2 as rs
10 
11 
12 # Declare pointcloud object, for calculating pointclouds and texture mappings
13 pc = rs.pointcloud()
14 # We want the points object to be persistent so we can display the last cloud when a frame drops
15 points = rs.points()
16 
17 # Declare RealSense pipeline, encapsulating the actual device and sensors
18 pipe = rs.pipeline()
19 config = rs.config()
20 # Enable depth stream
21 config.enable_stream(rs.stream.depth)
22 
23 # Start streaming with chosen configuration
24 pipe.start(config)
25 
26 # We'll use the colorizer to generate texture for our PLY
27 # (alternatively, texture can be obtained from color or infrared stream)
28 colorizer = rs.colorizer()
29 
30 try:
31  # Wait for the next set of frames from the camera
32  frames = pipe.wait_for_frames()
33  colorized = colorizer.process(frames)
34 
35  # Create save_to_ply object
36  ply = rs.save_to_ply("1.ply")
37 
38  # Set options to the desired values
39  # In this example we'll generate a textual PLY with normals (mesh is already created by default)
40  ply.set_option(rs.save_to_ply.option_ply_binary, False)
41  ply.set_option(rs.save_to_ply.option_ply_normals, True)
42 
43  print("Saving to 1.ply...")
44  # Apply the processing block to the frameset which contains the depth frame and the texture
45  ply.process(colorized)
46  print("Done")
47 finally:
48  pipe.stop()
static std::string print(const transformation &tf)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:14