34 std::cerr <<
"No device connected, please connect a RealSense device" << std::endl;
45 std::cout <<
"Found the following devices:\n" << std::endl;
59 if (selected_device_index >=
devices.size())
61 throw std::out_of_range(
"Selected device index is out of range");
65 selected_device =
devices[selected_device_index];
68 return selected_device;
76 std::cout <<
"Device information: " << std::endl;
83 std::cout <<
" " <<
std::left << std::setw(20) << info_type <<
" : ";
87 if (
dev.supports(info_type))
88 std::cout <<
dev.get_info(info_type) << std::endl;
90 std::cout <<
"N/A" << std::endl;
115 return "Unknown Sensor";
126 std::vector<rs2::sensor>
sensors =
dev.query_sensors();
128 std::cout <<
"Device consists of " <<
sensors.size() <<
" sensors:\n" << std::endl;
139 if (selected_sensor_index >=
sensors.size())
141 throw std::out_of_range(
"Selected sensor index is out of range");
144 return sensors[selected_sensor_index];
152 std::cout <<
"Sensor supports the following options:\n" << std::endl;
160 std::cout <<
" " <<
i <<
": " << option_type;
165 if (
sensor.supports(option_type))
167 std::cout << std::endl;
170 const char* description =
sensor.get_option_description(option_type);
171 std::cout <<
" Description : " << description << std::endl;
174 float current_value =
sensor.get_option(option_type);
175 std::cout <<
" Current Value : " << current_value << std::endl;
181 std::cout <<
" is not supported" << std::endl;
188 throw std::out_of_range(
"Selected option is out of range");
190 return static_cast<rs2_option>(selected_sensor_option);
201 float scale = dpt_sensor.get_depth_scale();
202 std::cout <<
"Scale factor for depth sensor is: " << scale << std::endl;
206 throw std::runtime_error(
"Given sensor is not a depth sensor");
226 std::cout <<
"Principal Point : " << principal_point.first <<
", " << principal_point.second << std::endl;
228 std::cout <<
"Distortion Model : " <<
model << std::endl;
229 std::cout <<
"Distortion Coefficients : [" <<
intrinsics.coeffs[0] <<
"," <<
intrinsics.coeffs[1] <<
"," <<
232 catch (
const std::exception&
e)
234 std::cerr <<
"Failed to get intrinsics for the given stream. " <<
e.what() << std::endl;
244 std::cout <<
" Scale X cross axis cross axis Bias X \n";
245 std::cout <<
" cross axis Scale Y cross axis Bias Y \n";
246 std::cout <<
" cross axis cross axis Scale Z Bias Z \n";
247 for (
int i = 0;
i < 3;
i++)
249 for (
int j = 0;
j < 4;
j++)
256 std::cout <<
"Variance of noise for X, Y, Z axis \n";
257 for (
int i = 0;
i < 3;
i++)
261 std::cout <<
"Variance of bias for X, Y, Z axis \n";
262 for (
int i = 0;
i < 3;
i++)
266 catch (
const std::exception&
e)
268 std::cerr <<
"Failed to get intrinsics for the given stream. " <<
e.what() << std::endl;
273 std::cerr <<
"Given stream profile has no intrinsics data" << std::endl;
285 std::cout <<
"Translation Vector : [" <<
extrinsics.translation[0] <<
"," <<
extrinsics.translation[1] <<
"," <<
extrinsics.translation[2] <<
"]\n";
290 catch (
const std::exception&
e)
292 std::cerr <<
"Failed to get extrinsics for the given streams. " <<
e.what() << std::endl;
304 if (!
sensor.supports(option_type))
306 std::cerr <<
"This option is not supported by this sensor" << std::endl;
313 std::cout <<
"Supported range for option " << option_type <<
":" << std::endl;
316 float default_value =
range.def;
317 float maximum_supported_value =
range.max;
318 float minimum_supported_value =
range.min;
319 float difference_to_next_value =
range.step;
320 std::cout <<
" Min Value : " << minimum_supported_value << std::endl;
321 std::cout <<
" Max Value : " << maximum_supported_value << std::endl;
322 std::cout <<
" Default Value : " << default_value << std::endl;
323 std::cout <<
" Step : " << difference_to_next_value << std::endl;
325 bool change_option =
false;
330 std::cout <<
"Enter the new value for this option: ";
331 float requested_value;
332 std::cin >> requested_value;
333 std::cout << std::endl;
338 sensor.set_option(option_type, requested_value);
344 std::cerr <<
"Failed to set option " << option_type <<
". (" <<
e.what() <<
")" << std::endl;
364 std::map<std::pair<rs2_stream, int>,
int> unique_streams;
367 unique_streams[std::make_pair(sp.stream_type(), sp.stream_index())]++;
369 std::cout <<
"Sensor consists of " << unique_streams.size() <<
" streams: " << std::endl;
370 for (
size_t i = 0;
i < unique_streams.size();
i++)
372 auto it = unique_streams.begin();
374 std::cout <<
" - " <<
it->first.first <<
" #" <<
it->first.second << std::endl;
378 std::cout <<
"Sensor provides the following stream profiles:" << std::endl;
414 std::cout << std::setw(3) << profile_num <<
": " << stream_data_type <<
" #" << stream_index;
426 std::cout <<
" (Video Stream: " << video_stream_profile.
format() <<
" " <<
427 video_stream_profile.
width() <<
"x" << video_stream_profile.
height() <<
"@ " << video_stream_profile.
fps() <<
"Hz)";
429 std::cout << std::endl;
436 throw std::out_of_range(
"Requested profile index is out of range");
455 std::ostringstream oss;
477 std::cout <<
"Streaming profile: " <<
stream_profile.stream_name() <<
". Close display window to continue..." << std::endl;