Depth Preset 更新

1. 目的

Gemini 330 新增了支持深度Preset 的更新,由于相机自带的Preset存放有限;因此我们支持3个Optional Depth Preset的更新,用户可以根据自身的具体应用场景在奥比提供的Depth Preset release 页面去下载对应的Preset 更新到相机进行使用,以便提供对应场景的更好深度性能。


2. 适用范围

适用于Gemini 330 系列固件版本1.4.60及以上的所有产品,SDK版本要求2.3.x及以上版本.


3. 如何更新Preset

3.1 如何通过Orbbec Viewer 更新Preset?

① 相机连接Orbbec Viewer 后点击Device Control,点击Optional depth preset 的Update 按钮,选择需要加载的Preset 文件,注意:一次最多同时支持3个Preset 的加载,加载后点击Update 即可更新到Device Preset 中,同时会显示在Optional depth preset 列表中。

image.png


更新成功:

image.png

② Optional depth preset 最大支持同时加载3个Preset 的更新,每次更新将覆盖替代之前的Optional depth preset


异常处理:

①如果导入存在重复Preset ,会提示存在重复配置,相同仅生效一个

image.png

②固件版本不支持或如导入机器不匹配:会提示"Error! The depth preset file are invalid ,Please select again"

image.png


3.2 如何通过SDK更新Preset?

参考sample:https://github.com/orbbec/OrbbecSDK_v2/blob/main/examples/2.device.optional_depth_presets_update/device.optional_depth_presets_update.cpp

/// 1.Create a context to access the connected devices
std::shared_ptr<ob::Context> context = std::make_shared<ob::Context>();

#if defined(__linux__)
// On Linux, it is recommended to use the libuvc backend for device access as v4l2 is not always reliable on some systems for preset update.
context->setUvcBackendType(OB_UVC_BACKEND_TYPE_LIBUVC);
#endif

/// 2. Access the connected devices
auto deviceList = context->queryDeviceList();
std::shared_ptr<ob::Device> device;
if (deviceList->getCount() > 0) {
    device = deviceList->getDevice(0);
}

/// 3. update optional depth presets
// Enter your preset file path, please enter 1-3
std::vector<std::string> pathList = {
    "/home/user/preset1.bin",
    "/home/user/preset2.bin",
    "/home/user/preset3.bin"
};

uint8_t index = 0;
uint8_t count = static_cast<uint8_t>(pathList.size());

// OB_PATH_MAX is defined as 1024
char(*filePaths)[OB_PATH_MAX] = new char[count][OB_PATH_MAX];

// copy paths
for(const auto &path: pathList) {
  strcpy(filePaths[index++], path.c_str());
}

// update optional depth presets
try {
    device->updateOptionalDepthPresets(filePaths, count, [&](OBFwUpdateState state, const char *message, uint8_t percent) {
    std::cout << "Message: " << message 
              << " percent: " << percent << "%" << std::endl;
  });

  // No exception if the upgrade is successful
  delete[] filePaths;
  filePaths = nullptr;
}
catch(ob::Error &e) {
  // Receive an exception if an error occurs
  std::cerr << "Error message: " << e.what() << "\n" << std::endl;
  delete[] filePaths;
  filePaths = nullptr;
}