9 Replies Latest reply on Jun 19, 2018 2:57 AM by Intel Corporation

    Issues with the json file does not loading, and image resolutions not get reported correctly

    MoA

      I am coming across three (3) issues, as listed below:

           1) The number of devices reported is 1 when no hardware is connected to the PC. When a RealSense device is actually connected to the PC, the reported number of devices is two (2). I thought that with no devices, I should get zero (0), and with one (1) device connected I should get one (1). Is this normal?

           2) I am using the snippet of code shown below to load a json file; the file does not get loaded; I know the file is good, because I can actually load it using the Depth Quality Tool. In fact, the json file was produced by the Depth Quality Tool.Also, I know that the path parameter I am passing to load_json is good; the file is really where the path says it is.

           3) using the same snippet of code shown below, I am trying  get the image resolution (Width and Height). The reported resolution values are invalid; nothing like the resolution (1280 x 720) I expect

       

      Can anyone tell me what is wrong with approach/code?

       

      Thanks in advanced.

       

      auto devices = context.query_devices();
      size_t NumberOfRealSenseDevices = devices.size();
      printf("NumberOfRealSenseDevices = %d\n", (int) NumberOfRealSenseDevices);

       

      // Get the first connected device
      auto RealSenseDevice = devices[0];

      // Check if current device supports advanced mode
      if (RealSenseDevice.is<rs400::advanced_mode>())
      {
            // Get the advanced mode functionality
            auto AdvancedModeDevice = RealSenseDevice.as<rs400::advanced_mode>();
            // Load the json file
            try
            {
                  AdvancedModeDevice.load_json(PathToConfigurationFile);
            }
            catch (...)
            {
                  return false;
            }
            // Get the image resolution
            try
            {
                  rs2::stream_profile  ColorImageProfile;
                  rs2_get_video_stream_resolution(ColorImageProfile.get(), &Width, &Height, NULL);
                  printf("Width = %d Height= %d\n", Width, Height);
            }
            catch (...)
            {
                  return false;
            }
      }
      else
            return false;