• <rt id="2awkm"><noscript id="2awkm"></noscript></rt>
      <rt id="2awkm"><noscript id="2awkm"></noscript></rt>
    • <dfn id="2awkm"></dfn>
      <menu id="2awkm"><acronym id="2awkm"></acronym></menu>
      
      
      <rt id="2awkm"></rt><dfn id="2awkm"><code id="2awkm"></code></dfn>
    • <dd id="2awkm"><s id="2awkm"></s></dd>
      <tbody id="2awkm"></tbody>
    • <dfn id="2awkm"></dfn>
      <menu id="2awkm"><noscript id="2awkm"></noscript></menu>

      C++ 多機(jī)同步示例代碼-Multi Device Sync

      # 多設(shè)備同步示例-MultiDeviceSync

      功能描述:演示多設(shè)備同步操作。

       

      >本示例基于C++ low Level API進(jìn)行演示

       

      配置程序模式

      std::cout << "Please select options: " << std::endl;
      std::cout << " 0 --> config devices" << std::endl;
      std::cout << " 1 --> start stream" << std::endl;
      std::cout << "input: ";
      int index = -1;
      std::cin >> index;

       

      配置多設(shè)備同步

      exitValue = configMultiDeviceSync();

       

      區(qū)分主從設(shè)備

      streamDevList.clear();
      // Query the list of connected devices
      auto devList = context.queryDeviceList();

      // Get the number of connected devices
      int devCount = devList->deviceCount();
      for(int i = 0; i < devCount; i++) {
          streamDevList.push_back(devList->getDevice(i));
      }

      if(streamDevList.empty()) {
          std::cerr << "Device list is empty. please check device connection state" << std::endl;
          return -1;
      }

      // traverse the device list and create the device
      std::vector<std::shared_ptr<ob::Device>> primary_devices;
      std::vector<std::shared_ptr<ob::Device>> secondary_devices;
      for(auto dev: streamDevList) {
          auto config = dev->getMultiDeviceSyncConfig();
          if(config.syncMode == OB_MULTI_DEVICE_SYNC_MODE_PRIMARY) {
              primary_devices.push_back(dev);
          }
          else {
              secondary_devices.push_back(dev);
          }
      }

       

      開啟從設(shè)備

      std::cout << "Secondary devices start..." << std::endl;
      int deviceIndex = 0;  // Sencondary device display first
      for(auto itr = secondary_devices.begin(); itr != secondary_devices.end(); itr++) {
          auto depthHolder = createPipelineHolder(*itr, OB_SENSOR_DEPTH, deviceIndex);
          pipelineHolderList.push_back(depthHolder);
          startStream(depthHolder);

          auto colorHolder = createPipelineHolder(*itr, OB_SENSOR_COLOR, deviceIndex);
          pipelineHolderList.push_back(colorHolder);
          startStream(colorHolder);

          deviceIndex++;
      }

       

      開啟主設(shè)備

      std::cout << "Primary device start..." << std::endl;
      deviceIndex = secondary_devices.size();  // Primary device display after primary devices.
      for(auto itr = primary_devices.begin(); itr != primary_devices.end(); itr++) {
          auto depthHolder = createPipelineHolder(*itr, OB_SENSOR_DEPTH, deviceIndex);
          startStream(depthHolder);
          pipelineHolderList.push_back(depthHolder);

          auto colorHolder = createPipelineHolder(*itr, OB_SENSOR_COLOR, deviceIndex);
          startStream(colorHolder);
          pipelineHolderList.push_back(colorHolder);

          deviceIndex++;
      }

       

      設(shè)置多設(shè)備同步間隔時(shí)間

      // Start the multi-device time synchronization function
      context.enableDeviceClockSync(3600000);  // update and sync every hour

       

      進(jìn)行多設(shè)備測試

      testMultiDeviceSync();

       

      關(guān)閉數(shù)據(jù)流

      // close data stream
      for(auto itr = pipelineHolderList.begin(); itr != pipelineHolderList.end(); itr++) {
          stopStream(*itr);
      }


      • <rt id="2awkm"><noscript id="2awkm"></noscript></rt>
        <rt id="2awkm"><noscript id="2awkm"></noscript></rt>
      • <dfn id="2awkm"></dfn>
        <menu id="2awkm"><acronym id="2awkm"></acronym></menu>
        
        
        <rt id="2awkm"></rt><dfn id="2awkm"><code id="2awkm"></code></dfn>
      • <dd id="2awkm"><s id="2awkm"></s></dd>
        <tbody id="2awkm"></tbody>
      • <dfn id="2awkm"></dfn>
        <menu id="2awkm"><noscript id="2awkm"></noscript></menu>
        日本3级网站 | 日本mm131爽爽爽免费图片 | 中文字幕成人网 | 伊人久久大香线蕉一区二区三区 | 乱伦内射视频 |