librealsense
librealsense copied to clipboard
How to change camera settings programmatically in C#
| Required Info | |
|---|---|
| Camera Model | D415 |
| Firmware Version | 05.08.15.00 |
| Operating System & Version | Win 10 |
| Platform | PC |
| SDK Version | 2.11.1 |
Issue Description
I am trying to change the camera settings such as exposure programmatically using the C# wrapper. I saw this explanation which points to the API how-to, but I was not able to find the same methods in the C# version of the Device class.
[Realsense Customer Engineering Team Comment] @blairlc Please refer to the code snippet below :PipelineProfile profile = pipeline.Start(cfg);
Pipeline pipeline = new Pipeline();
var cfg = new Config();
cfg.EnableStream(Stream.Depth, 640, 480);
cfg.EnableStream(Stream.Color, Format.Rgb8);
PipelineProfile profile = pipeline.Start(cfg);Sensor sensor = profile.Device.Sensors[0];
foreach(Sensor.CameraOption opt in sensor.Options)
{
if (opt.Key == Option.LaserPower && opt.Supported)
{
Console.WriteLine("\nLaser Power before change{0}", opt.Value);
opt.Value = opt.Value + opt.Step;
Console.WriteLine("\nLaser Power after change{0}", opt.Value);
}
}
[Realsense Customer Engineering Team Comment] @blairlc Does the code answer your question? Can the ticket be closed?
Yes, I was able to figure out what I needed from that. Thanks.