6 Replies Latest reply on Mar 23, 2018 2:02 PM by Intel Corporation

    Changing the resolution and framerate of enabled devices (D435) in rs-multicam.cpp

    jmagen

      Hi everyone,

       

      I've been learning the SDK while building a project around the multicam SDK sample. I would now like to change the resolution and framerate that is given to a configuration in the rs-multicam.cpp sample. I'm not sure if I can set the framerate and resolution of a device before enabling it:

      // Initial population of the device list
      for (auto&& dev : ctx.query_devices()) // Query the list of connected RealSense devices
      {
           // Can I modify dev here?
           connected_devices.enable_device(dev);
      }
      

      or if I would need to modify the enable_device() function: 

      void enable_device(rs2::device dev)
          {
              std::string serial_number(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER));
              std::lock_guard<std::mutex> lock(_mutex);
      
      
              if (_devices.find(serial_number) != _devices.end())
              {
                  return; //already in
              }
      
      
              // Ignoring platform cameras (webcams, etc..)
              if (platform_camera_name == dev.get_info(RS2_CAMERA_INFO_NAME))
              {
                  return;
              }
              // Create a pipeline from the given device
              rs2::pipeline p;
              rs2::config c;
              c.enable_device(serial_number);
              // Start the pipeline with the configuration
              rs2::pipeline_profile profile = p.start(c);
              // Hold it internally
              _devices.emplace(serial_number, view_port{ {},{},{}, p, profile });
      
          }
      

      If I could set the resolution and framerate options to be the same across all cameras in a configuration, that would be helpful in my case. I'm hoping to be able to optimize these settings, while mostly retaining the device_container functions, but let me know if there's a better way to approach this.

       

      Thank you,

      jmagen