Article ID: 000028416 Content Type: Maintenance & Performance Last Reviewed: 07/09/2021

How to Use Intel® RealSense™ Viewer Presets in C++?

Environment

Intel® RealSense™ D400 Series Intel® RealSense™ Camera SR300 

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

This article provides the code line needed to add into your C++ project for getting the Intel® RealSense™ viewer presets.

Description

How can I use the preset JSON (JavaScript Object Notation) files from Intel® RealSense™ Viewer in my C++ code?

Resolution

One option for using the Presets in C++ is to add to your code the following lines: 

PipelineProfile profile = pipeline.Start(cfg);  
var depthSensor = profile.Device.QuerySensors()[0];  
if (depthSensor.Options[Option.VisualPreset].Supported)  
depthSensor.Options[Option.VisualPreset].Value = (float)Rs400VisualPreset.HighDensity;   
 

Read more about it here

Another option will be to use these code lines: 


auto sensor = profile.get_device().first<rs2::depth_sensor>();
sensor.set_option(rs2_option::RS2_OPTION_VISUAL_PRESET, rs2_rs400_visual_preset::RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY);