rs-capture.cpp
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 #include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
5 #include "example.hpp" // Include short list of convenience functions for rendering
6 
7 // Capture Example demonstrates how to
8 // capture depth and color video streams and render them to the screen
9 int main(int argc, char * argv[]) try
10 {
12  // Create a simple OpenGL window for rendering:
13  window app(1280, 720, "RealSense Capture Example");
14 
15  // Declare depth colorizer for pretty visualization of depth data
16  rs2::colorizer color_map;
17  // Declare rates printer for showing streaming rates of the enabled streams.
18  rs2::rates_printer printer;
19 
20  // Declare RealSense pipeline, encapsulating the actual device and sensors
22 
23  // Start streaming with default recommended configuration
24  // The default video configuration contains Depth and Color streams
25  // If a device is capable to stream IMU data, both Gyro and Accelerometer are enabled by default
26  pipe.start();
27 
28  while (app) // Application still alive?
29  {
30  rs2::frameset data = pipe.wait_for_frames(). // Wait for next set of frames from the camera
31  apply_filter(printer). // Print each enabled stream frame rate
32  apply_filter(color_map); // Find and colorize the depth data
33 
34  // The show method, when applied on frameset, break it to frames and upload each frame into a gl textures
35  // Each texture is displayed on different viewport according to it's stream unique id
36  app.show(data);
37  }
38 
39  return EXIT_SUCCESS;
40 }
41 catch (const rs2::error & e)
42 {
43  std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;
44  return EXIT_FAILURE;
45 }
46 catch (const std::exception& e)
47 {
48  std::cerr << e.what() << std::endl;
49  return EXIT_FAILURE;
50 }
frameset wait_for_frames(unsigned int timeout_ms=RS2_DEFAULT_TIMEOUT) const
e
Definition: rmse.py:177
const std::string & get_failed_args() const
Definition: rs_types.hpp:117
void show(rs2::frame frame)
Definition: example.hpp:652
void log_to_console(rs2_log_severity min_severity)
Definition: rs.hpp:19
int main(int argc, char *argv[])
Definition: rs-capture.cpp:9
std::ostream & cerr()
pipeline_profile start()
const std::string & get_failed_function() const
Definition: rs_types.hpp:112
Definition: parser.hpp:150


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