mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 20:17:47 +08:00
fix: reorganize bundled SDK layout
Keep the vendor SDK filenames unchanged. Downstream packages can find the versioned orbbec_camera ROS package and link its installed OrbbecSDK library instead of requiring OrbbecSDKConfigVersion.cmake.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* \file ObSensor.h
|
||||
* \brief This file serves as the C entrance for the SDK library.
|
||||
* It includes all necessary header files for SDK usage.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <libobsensor/h/Context.h>
|
||||
#include <libobsensor/h/Device.h>
|
||||
#include <libobsensor/h/Error.h>
|
||||
#include <libobsensor/h/Filter.h>
|
||||
#include <libobsensor/h/Frame.h>
|
||||
#include <libobsensor/h/ObTypes.h>
|
||||
#include <libobsensor/h/Pipeline.h>
|
||||
#include <libobsensor/h/Property.h>
|
||||
#include <libobsensor/h/Sensor.h>
|
||||
#include <libobsensor/h/StreamProfile.h>
|
||||
#include <libobsensor/h/Version.h>
|
||||
#include <libobsensor/h/TypeHelper.h>
|
||||
#include <libobsensor/h/RecordPlayback.h>
|
||||
#include <libobsensor/h/ApplicationConfig.h>
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* \file ObSensor.hpp
|
||||
* \brief This is the main entry point for the SDK C++ library.
|
||||
* It includes all necessary header files for using the library.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <libobsensor/hpp/Context.hpp>
|
||||
#include <libobsensor/hpp/Device.hpp>
|
||||
#include <libobsensor/hpp/Error.hpp>
|
||||
#include <libobsensor/hpp/Filter.hpp>
|
||||
#include <libobsensor/hpp/Frame.hpp>
|
||||
#include <libobsensor/hpp/Pipeline.hpp>
|
||||
#include <libobsensor/hpp/RecordPlayback.hpp>
|
||||
#include <libobsensor/hpp/ApplicationConfig.hpp>
|
||||
#include <libobsensor/hpp/Sensor.hpp>
|
||||
#include <libobsensor/hpp/StreamProfile.hpp>
|
||||
#include <libobsensor/hpp/Version.hpp>
|
||||
#include <libobsensor/hpp/TypeHelper.hpp>
|
||||
@@ -0,0 +1,419 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Get the current depth work mode.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_depth_work_mode The current depth work mode.
|
||||
*/
|
||||
OB_EXPORT ob_depth_work_mode ob_device_get_current_depth_work_mode(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get current depth mode name
|
||||
* @brief According the current preset name to return current depth mode name
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return the current depth mode name.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_get_current_depth_work_mode_name(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch the depth work mode by ob_depth_work_mode.
|
||||
* Prefer to use ob_device_switch_depth_work_mode_by_name to switch depth mode when the complete name of the depth work mode is known.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] work_mode The depth work mode from ob_depth_work_mode_list which is returned by ob_device_get_depth_work_mode_list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_status The switch result. OB_STATUS_OK: success, other failed.
|
||||
*/
|
||||
OB_EXPORT ob_status ob_device_switch_depth_work_mode(ob_device *device, const ob_depth_work_mode *work_mode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch the depth work mode by work mode name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] mode_name The depth work mode name which is equal to ob_depth_work_mode.name.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_status The switch result. OB_STATUS_OK: success, other failed.
|
||||
*/
|
||||
OB_EXPORT ob_status ob_device_switch_depth_work_mode_by_name(ob_device *device, const char *mode_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Request the list of supported depth work modes.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_depth_work_mode_list The list of ob_depth_work_mode.
|
||||
*/
|
||||
OB_EXPORT ob_depth_work_mode_list *ob_device_get_depth_work_mode_list(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the depth work mode count that ob_depth_work_mode_list hold
|
||||
*
|
||||
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The total number contained in ob_depth_work_mode_list
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_depth_work_mode_list_get_count(const ob_depth_work_mode_list *work_mode_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the index target of ob_depth_work_mode from work_mode_list
|
||||
*
|
||||
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
|
||||
* @param[in] index Index of the target ob_depth_work_mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_depth_work_mode
|
||||
*/
|
||||
OB_EXPORT ob_depth_work_mode ob_depth_work_mode_list_get_item(const ob_depth_work_mode_list *work_mode_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Free the resources of ob_depth_work_mode_list
|
||||
*
|
||||
* @param[in] work_mode_list Data structure containing a list of ob_depth_work_mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_depth_work_mode_list(ob_depth_work_mode_list *work_mode_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current preset name.
|
||||
* @brief The preset mean a set of parameters or configurations that can be applied to the device to achieve a specific effect or function.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The current preset name, it should be one of the preset names returned by @ref ob_device_get_available_preset_list.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_get_current_preset_name(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available preset list.
|
||||
* @attention After loading the preset, the settings in the preset will set to the device immediately. Therefore, it is recommended to re-read the device
|
||||
* settings to update the user program temporarily.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] preset_name Pointer to an error object that will be set if an error occurs. The name should be one of the preset names returned by @ref
|
||||
* ob_device_get_available_preset_list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_preset(ob_device *device, const char *preset_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Load preset from json string.
|
||||
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
|
||||
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the file name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] json_file_path The json file path.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_preset_from_json_file(ob_device *device, const char *json_file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Load custom preset from data.
|
||||
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
|
||||
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the @p presetName.
|
||||
*
|
||||
* @attention The user should ensure that the custom preset data is adapted to the device and the settings in the data are valid.
|
||||
* @attention It is recommended to re-read the device settings to update the user program temporarily after successfully loading the custom preset.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] presetName The name of the custome preset.
|
||||
* @param[in] data The custom preset data.
|
||||
* @param[in] size The size of the custom preset data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_preset_from_json_data(ob_device *device, const char *presetName, const uint8_t *data, uint32_t size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Export current settings as a preset json file.
|
||||
* @brief After exporting the custom preset, the available preset list will be appended with the custom preset and named as the file name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] json_file_path The json file path.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_export_current_settings_as_preset_json_file(ob_device *device, const char *json_file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Export current device settings as a preset json data.
|
||||
* @brief After exporting the preset, a new preset named as the @p presetName will be added to the available preset list.
|
||||
*
|
||||
* @attention The memory of the data is allocated by the SDK, and will automatically be released by the SDK.
|
||||
* @attention The memory of the data will be reused by the SDK on the next call, so the user should copy the data to a new buffer if it needs to be
|
||||
* preserved.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] presetName The name of the custome preset.
|
||||
* @param[out] data Return the preset json data.
|
||||
* @param[out] dataSize Return the size of the preset json data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_export_current_settings_as_preset_json_data(ob_device *device, const char *presetName, const uint8_t **data, uint32_t *dataSize,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available preset list.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The available preset list.
|
||||
*/
|
||||
OB_EXPORT ob_device_preset_list *ob_device_get_available_preset_list(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the available preset list.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_preset_list(ob_device_preset_list *preset_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of preset in the preset list.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of preset in the preset list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_preset_list_get_count(const ob_device_preset_list *preset_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the preset in the preset list.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[in] index The index of the preset in the preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The name of the preset in the preset list.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_preset_list_get_name(const ob_device_preset_list *preset_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the preset list has the preset.
|
||||
*
|
||||
* @param[in] preset_list The available preset list.
|
||||
* @param[in] preset_name The name of the preset.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return Whether the preset list has the preset. If true, the preset list has the preset. If false, the preset list does not have the preset.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_preset_list_has_preset(const ob_device_preset_list *preset_list, const char *preset_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the device supports the frame interleave feature.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Returns true if the device supports the frame interleave feature.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_is_frame_interleave_supported(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief load the frame interleave mode according to frame interleave name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] frame_interleave_name The name should be one of the frame interleave names returned by @ref ob_device_get_available_frame_interleave_list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_load_frame_interleave(ob_device *device, const char *frame_interleave_name, ob_error **error);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get current frame interleave name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* return the current frame interleave name.
|
||||
* Returns an empty string ("") if no interleave is loaded.
|
||||
* Returns nullptr if an error occurs.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_get_current_frame_interleave_name(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available frame interleave list.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The available frame interleave list.
|
||||
*/
|
||||
OB_EXPORT ob_device_frame_interleave_list *ob_device_get_available_frame_interleave_list(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the available frame interleave list.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available frame interleave list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_frame_interleave_list(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of frame interleave in the frame interleave list.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available frame interleave list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of frame interleave in the frame interleave list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_frame_interleave_list_get_count(ob_device_frame_interleave_list *frame_interleave_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of frame interleave in the frame interleave list.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available frame interleave list.
|
||||
* @param[in] index The index of frame interleave in the frame interleave list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The name of frame interleave in the frame interleave list..
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_frame_interleave_list_get_name(ob_device_frame_interleave_list *frame_interleave_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the interleave ae list has the interleave ae.
|
||||
*
|
||||
* @param[in] frame_interleave_list The available interleave ae list.
|
||||
* @param[in] frame_interleave_name The name of the interleave ae.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return Whether the interleave ae list has the interleave ae. If true, the interleave ae list has the interleave ae. If false, the interleave ae list does
|
||||
* not have the interleave ae.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_frame_interleave_list_has_frame_interleave(ob_device_frame_interleave_list *frame_interleave_list, const char *frame_interleave_name,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available preset resolution config list.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The available frame resolution config list.
|
||||
*/
|
||||
OB_EXPORT ob_preset_resolution_config_list *ob_device_get_available_preset_resolution_config_list(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of preset resolution in the preset resolution list.
|
||||
*
|
||||
* @param[in] ob_preset_resolution_config_list The available preset resolution list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of preset resolution in the preset resolution list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_device_preset_resolution_config_get_count(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the preset resolution in the preset resolution list.
|
||||
*
|
||||
* @param[in] ob_preset_resolution_config_list The available preset resolution list.
|
||||
* @param[in] index The index of preset resolution in the preset resolution list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The preset resolution in the preset resolution list.
|
||||
*/
|
||||
OB_EXPORT OBPresetResolutionConfig ob_device_preset_resolution_config_list_get_item(const ob_preset_resolution_config_list *ob_preset_resolution_config_list,
|
||||
uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the available preset resolution list.
|
||||
*
|
||||
* @param[in] ob_preset_resolution_config_list The available preset resolution list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_preset_resolution_config_list(ob_preset_resolution_config_list *ob_preset_resolution_config_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check if the device supports color preset.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Returns true if the device supports color preset.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_is_color_preset_supported(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current color preset name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The current color preset name.
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_get_current_color_preset_name(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch the color preset by name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] preset_name The color preset name.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_switch_color_preset(ob_device *device, const char *preset_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the available color preset list.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_color_preset_list* The color preset list.
|
||||
*/
|
||||
OB_EXPORT ob_color_preset_list *ob_device_get_color_preset_list(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of color preset in the list.
|
||||
*
|
||||
* @param[in] list The color preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t The number of color preset in the list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_color_preset_list_get_count(const ob_color_preset_list *list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of color preset at the specified index.
|
||||
*
|
||||
* @param[in] list The color preset list.
|
||||
* @param[in] index The index of the color preset.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The name of the color preset.
|
||||
*/
|
||||
OB_EXPORT const char *ob_color_preset_list_get_name(const ob_color_preset_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the color preset list.
|
||||
*
|
||||
* @param[in] list The color preset list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_color_preset_list(ob_color_preset_list *list, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_depth_work_mode_list_count ob_depth_work_mode_list_get_count
|
||||
#define ob_device_preset_list_count ob_device_preset_list_get_count
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,267 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Application configuration key.
|
||||
* Each key has a fixed value type and item usage.
|
||||
* Keys must stay within the low 32 bits because @ref OBAppConfigItem stores the key in bits 0-31.
|
||||
*/
|
||||
typedef enum {
|
||||
OB_APP_CONFIG_SENSORS = 0, /**< array, sensor list. Use @ref ob_application_config_get_count to get sensor count. */
|
||||
OB_APP_CONFIG_SENSOR_TYPE = 1, /**< int32_t, sensor item: OBSensorType. */
|
||||
OB_APP_CONFIG_STREAM_ENABLED = 2, /**< bool, sensor item: whether the sensor stream should be started. */
|
||||
OB_APP_CONFIG_STREAM_PROFILE = 3, /**< ob_stream_profile, sensor item: stream profile. */
|
||||
OB_APP_CONFIG_UNDISTORTION_ENABLED = 4, /**< bool, sensor item: whether undistortion should be enabled. */
|
||||
|
||||
OB_APP_CONFIG_DEVICE_DECIMATION_ENABLED = 5, /**< bool, global item: whether device-level decimation should be applied. */
|
||||
OB_APP_CONFIG_DEVICE_DECIMATION = 6, /**< OBPresetResolutionConfig, global item: device-level decimation configuration. */
|
||||
/**< Currently applied only by Gemini 435Le. */
|
||||
// Point cloud
|
||||
OB_APP_CONFIG_POINTCLOUD_ENABLED = 100, /**< bool, global item: whether point cloud output should be enabled. */
|
||||
OB_APP_CONFIG_POINTCLOUD_FORMAT = 101, /**< int32_t, global item: OBFormat, point cloud output format. */
|
||||
OB_APP_CONFIG_POINTCLOUD_DECIMATION_FACTOR = 102, /**< int32_t, global item: point cloud decimation factor. */
|
||||
OB_APP_CONFIG_POINTCLOUD_ALIGN_MODE = 103, /**< int32_t, global item: OBAlignMode. */
|
||||
OB_APP_CONFIG_POINTCLOUD_FRAME_SYNC = 104, /**< bool, global item: whether frame sync should be enabled. */
|
||||
OB_APP_CONFIG_POINTCLOUD_ALL_FRAME_TYPE_REQUIRED = 105, /**< bool, global item: false: output on any situation, true: require all frame types. */
|
||||
OB_APP_CONFIG_POINTCLOUD_MATCH_TARGET_RESOLUTION = 106, /**< bool, global item: whether to match target resolution. */
|
||||
// HDR Merge
|
||||
OB_APP_CONFIG_HDR_MERGE_ENABLED = 200, /**< bool, global item: whether HDR merge should be enabled. */
|
||||
OB_APP_CONFIG_HDR_MERGE_IR_ENABLED = 201, /**< bool, global item: whether IR frame should be enabled for HDR merge. */
|
||||
} OBAppConfigKey,
|
||||
ob_app_config_key;
|
||||
|
||||
/**
|
||||
* @brief Application configuration item.
|
||||
* An item combines a configuration key and an optional array index.
|
||||
* Non-array keys use @ref OB_APP_CONFIG_ITEM.
|
||||
* Array keys use @ref OB_APP_CONFIG_ARRAY_ITEM.
|
||||
* The key is stored in bits 0-31 and the index is stored in bits 32-63.
|
||||
*/
|
||||
typedef uint64_t OBAppConfigItem, ob_app_config_item;
|
||||
|
||||
#define OB_APP_CONFIG_INDEX_NONE (0u)
|
||||
#define OB_APP_CONFIG_ITEM(key) ((OBAppConfigItem)(uint32_t)(key))
|
||||
#define OB_APP_CONFIG_ARRAY_ITEM(key, index) ((((OBAppConfigItem)(uint32_t)(index)) << 32) | (OBAppConfigItem)(uint32_t)(key))
|
||||
#define OB_APP_CONFIG_ITEM_KEY(item) ((OBAppConfigKey)((uint32_t)((item) & 0xFFFFFFFFu)))
|
||||
#define OB_APP_CONFIG_ITEM_INDEX(item) ((uint32_t)(((item) >> 32) & 0xFFFFFFFFu))
|
||||
|
||||
/**
|
||||
* @brief Application configuration value type.
|
||||
*/
|
||||
typedef enum {
|
||||
OB_APP_CONFIG_VALUE_BOOL, /**< Boolean value. */
|
||||
OB_APP_CONFIG_VALUE_INT, /**< int32_t value. */
|
||||
OB_APP_CONFIG_VALUE_FLOAT, /**< float value. */
|
||||
OB_APP_CONFIG_VALUE_STRING, /**< String value. The returned pointer is owned by the config object. */
|
||||
OB_APP_CONFIG_VALUE_STRUCT, /**< Fixed-size SDK structure value. */
|
||||
} OBAppConfigValueType,
|
||||
ob_app_config_value_type;
|
||||
|
||||
/**
|
||||
* @brief Get the application runtime configuration cache for the device.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_application_config* The application configuration object cached by the device.
|
||||
* @attention If the device has no application configuration cache, the SDK creates one with default values.
|
||||
* @attention Changes made through the returned config update the device cache directly.
|
||||
* @attention The returned config should be released by calling @ref ob_delete_application_config.
|
||||
*/
|
||||
OB_EXPORT ob_application_config *ob_device_get_application_config(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the application configuration carried by an externally imported preset, by preset name.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[in] preset_name The preset name to query.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_application_config* The application configuration imported with the given preset, or NULL for
|
||||
* built-in presets or presets that carry no application configuration.
|
||||
* @attention The returned config is owned by the device; it should still be released by calling
|
||||
* @ref ob_delete_application_config (releasing the handle does not destroy the cached object).
|
||||
*/
|
||||
OB_EXPORT ob_application_config *ob_device_get_application_config_by_preset(ob_device *device, const char *preset_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete an application configuration object.
|
||||
*
|
||||
* @param[in] config The application configuration object to be deleted.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_application_config(ob_application_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Check whether the current device supports application runtime configuration import/export.
|
||||
*
|
||||
* @param[in] device The device object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Return true if application configuration import/export is supported, false otherwise.
|
||||
*/
|
||||
OB_EXPORT bool ob_device_is_application_config_supported(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Reset an application configuration object to default values.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_reset(ob_application_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a bool value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[in] value The bool value to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_set_bool(ob_application_config *config, OBAppConfigItem item, bool value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a bool value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool The bool value.
|
||||
*/
|
||||
OB_EXPORT bool ob_application_config_get_bool(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set an int32_t value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[in] value The int32_t value to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_set_int(ob_application_config *config, OBAppConfigItem item, int32_t value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get an int32_t value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int32_t The int32_t value.
|
||||
*/
|
||||
OB_EXPORT int32_t ob_application_config_get_int(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a float value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[in] value The float value to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_set_float(ob_application_config *config, OBAppConfigItem item, float value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a float value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float The float value.
|
||||
*/
|
||||
OB_EXPORT float ob_application_config_get_float(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a string value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[in] value The string value to be set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_set_string(ob_application_config *config, OBAppConfigItem item, const char *value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a string value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* The string value.
|
||||
* @attention The returned pointer is owned by the config object and becomes invalid after the config is modified or deleted.
|
||||
*/
|
||||
OB_EXPORT const char *ob_application_config_get_string(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a fixed-size SDK structure value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to update. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[in] value Pointer to the structure value to be copied.
|
||||
* @param[in] valueSize Size of the structure value in bytes.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_set_struct(ob_application_config *config, OBAppConfigItem item, const void *value, uint32_t valueSize, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a fixed-size SDK structure value.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The configuration item to read. Use @ref OB_APP_CONFIG_ITEM or @ref OB_APP_CONFIG_ARRAY_ITEM to build it.
|
||||
* @param[out] value Pointer to the buffer that receives the structure value.
|
||||
* @param[in] valueSize Size of the output buffer in bytes.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_get_struct(const ob_application_config *config, OBAppConfigItem item, void *value, uint32_t valueSize, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the stream profile for a sensor item.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The sensor stream profile item to update. Use @ref OB_APP_CONFIG_ARRAY_ITEM with @ref OB_APP_CONFIG_STREAM_PROFILE.
|
||||
* @param[in] profile The stream profile to be copied into the config object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @attention The config object clones the profile. The caller still owns and should release the input profile.
|
||||
*/
|
||||
OB_EXPORT void ob_application_config_set_profile(ob_application_config *config, OBAppConfigItem item, const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile from a sensor item.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] item The sensor stream profile item to read. Use @ref OB_APP_CONFIG_ARRAY_ITEM with @ref OB_APP_CONFIG_STREAM_PROFILE.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* The stream profile stored in the sensor item.
|
||||
* @attention The returned profile should be released by calling @ref ob_delete_stream_profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_application_config_get_profile(const ob_application_config *config, OBAppConfigItem item, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of items in an array key.
|
||||
*
|
||||
* Currently only @ref OB_APP_CONFIG_SENSORS is supported.
|
||||
*
|
||||
* @param[in] config The application configuration object.
|
||||
* @param[in] key The array key to count. Refer to @ref OBAppConfigKey for available keys.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t The number of items in the array key.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_application_config_get_count(const ob_application_config *config, OBAppConfigKey key, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,323 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Context.h
|
||||
* @brief Context is a management class that describes the runtime of the SDK and is responsible for resource allocation and release of the SDK.
|
||||
* Context has the ability to manage multiple devices. It is responsible for enumerating devices, monitoring device callbacks, and enabling multi-device
|
||||
* synchronization.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a context object with the default configuration file
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during context creation
|
||||
*
|
||||
* @return Pointer to the created context object
|
||||
*/
|
||||
OB_EXPORT ob_context *ob_create_context(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a context object with a specified configuration file
|
||||
*
|
||||
* @param[in] config_file_path Path to the configuration file. If NULL, the default configuration file will be used.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during context creation
|
||||
*
|
||||
* @return Pointer to the created context object
|
||||
*/
|
||||
OB_EXPORT ob_context *ob_create_context_with_config(const char *config_file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a context object
|
||||
*
|
||||
* @param[in] context Pointer to the context object to be deleted
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during context deletion
|
||||
*/
|
||||
OB_EXPORT void ob_delete_context(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a list of enumerated devices
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during device enumeration
|
||||
*
|
||||
* @return Pointer to the device list object
|
||||
*/
|
||||
OB_EXPORT ob_device_list *ob_query_device_list(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable network device enumeration
|
||||
* @brief After enabling, the network device will be automatically discovered and can be retrieved through @ref ob_query_device_list. The default state can be
|
||||
* set in the configuration file.
|
||||
*
|
||||
* @attention Network device enumeration is performed through the GVCP protocol. If the device is not in the same subnet as the host, it will be discovered but
|
||||
* cannot be connected.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] enable true to enable, false to disable
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_enable_net_device_enumeration(ob_context *context, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief "Force" a static IP address configuration in a device identified by its MAC Address.
|
||||
*
|
||||
* @param[in] macAddress MAC address of the network device.
|
||||
* You can obtain it from @ref ob_device_info_get_uid, or specify it manually
|
||||
* in the format xx:xx:xx:xx:xx:xx, where each xx is a two-digit hexadecimal value.
|
||||
* @param[in] config The new IP configuration.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs.
|
||||
*
|
||||
* @return bool true if the configuration command was processed successfully, false otherwise.
|
||||
* @note This applies to all GVCP devices
|
||||
*/
|
||||
OB_EXPORT bool ob_force_ip_config(const char *macAddress, ob_net_ip_config config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the GVCP port scheme used for network device discovery and control.
|
||||
*
|
||||
* @param[in] context Pointer to the context object.
|
||||
* @param[in] scheme Target GVCP port scheme.
|
||||
* Return error if the specified scheme is invalid or unsupported.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs.
|
||||
*
|
||||
* @note This change affects only the current session and is not persisted.
|
||||
* @note Switching to a different scheme will force disconnection of all currently connected network devices.
|
||||
*/
|
||||
OB_EXPORT void ob_set_gvcp_port_scheme(ob_context *context, ob_gvcp_port_scheme scheme, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current GVCP port scheme.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs.
|
||||
*
|
||||
* @return Current GVCP port scheme.
|
||||
*/
|
||||
OB_EXPORT ob_gvcp_port_scheme ob_get_gvcp_port_scheme(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a network device object
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] address IP address of the device
|
||||
* @param[in] port Port number of the device
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during device creation
|
||||
*
|
||||
* @return Pointer to the created device object
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_create_net_device(ob_context *context, const char *address, uint16_t port, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a network device object
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] address IP address of the device
|
||||
* @param[in] port Port number of the device
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during device creation
|
||||
*
|
||||
* @return Pointer to the created device object
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_create_net_device_ex(ob_context *context, const char *address, uint16_t port, ob_device_access_mode accessMode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a device plug-in callback function
|
||||
*
|
||||
* @deprecated This function is deprecated. Please use ob_register_device_changed_callback() instead.
|
||||
*
|
||||
* @attention The added and removed device lists returned through the callback interface need to be released manually
|
||||
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] callback Pointer to the callback function triggered when a device is plugged or unplugged
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during callback function setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_device_changed_callback(ob_context *context, ob_device_changed_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Register a device plug-in callback function.
|
||||
*
|
||||
* This function registers a callback that will be triggered whenever a device is plugged in or unplugged.
|
||||
*
|
||||
* @attention The added and removed device lists returned through the callback interface need to be released manually.
|
||||
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
|
||||
*
|
||||
* @param[in] context Pointer to the context object.
|
||||
* @param[in] callback Pointer to the callback function triggered when a device is plugged or unplugged.
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during callback function setting.
|
||||
*
|
||||
* @return A ob_callback_id that uniquely identifies the registered callback.
|
||||
* This ID can be used later to unregister the callback with ob_unregister_device_changed_callback().
|
||||
* Returns INVALID_DEVICE_CHANGED_CALLBACK_ID if the registration fails.
|
||||
*/
|
||||
OB_EXPORT ob_callback_id ob_register_device_changed_callback(ob_context *context, ob_device_changed_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Unregister a previously registered device plug-in callback function.
|
||||
*
|
||||
* This function removes a callback that was registered by ob_register_device_changed_callback().
|
||||
*
|
||||
* @param[in] context Pointer to the context object.
|
||||
* @param[in] callback_id The callback ID returned by ob_register_device_changed_callback().
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during callback function setting.
|
||||
*/
|
||||
OB_EXPORT void ob_unregister_device_changed_callback(ob_context *context, ob_callback_id callback_id, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] repeat_interval_msec The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during execution
|
||||
*/
|
||||
OB_EXPORT void ob_enable_device_clock_sync(ob_context *context, uint64_t repeat_interval_msec, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Synchronize the device time (synchronize hardwarePPS time to all created devices)
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] hardware_pps_time unit: ms.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during execution
|
||||
*/
|
||||
OB_EXPORT void ob_sync_device_hardware_pps_time(ob_context *context, uint64_t hardware_pps_time, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Free idle memory from the internal frame memory pool
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during memory freeing
|
||||
*/
|
||||
OB_EXPORT void ob_free_idle_memory(ob_context *context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
|
||||
* @brief It is effective when the new device is created.
|
||||
*
|
||||
* @attention This interface is only available for Linux.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] backend_type The backend type to be used.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during backend type setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_uvc_backend_type(ob_context *context, ob_uvc_backend_type backend_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the global log level
|
||||
*
|
||||
* @attention This interface setting will affect the output level of all logs (terminal, file, callback)
|
||||
*
|
||||
* @param[in] severity Log level to set
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log level setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_severity(ob_log_severity severity, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log output to a file
|
||||
*
|
||||
* @param[in] severity Log level to output to file
|
||||
* @param[in] directory Path to the log file output directory.
|
||||
* If empty, the existing configuration is used;
|
||||
* if the existing configuration is also empty,
|
||||
* the value from the config file or the default configuration will be used.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
|
||||
*
|
||||
* @note Other settings, such as log file name, remain unchanged.
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_to_file(ob_log_severity severity, const char *directory, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log file name for file output
|
||||
*
|
||||
* @param[in] file_name Log file name. Must not be empty.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @note Other settings, such as log level and output directory, remain unchanged.
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_file_name(const char *file_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log callback function
|
||||
*
|
||||
* @param[in] severity Log level to set for the callback function
|
||||
* @param[in] callback Pointer to the callback function
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log callback function setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_to_callback(ob_log_severity severity, ob_log_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the log output to the console
|
||||
*
|
||||
* @param[in] severity Log level to output to the console
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_logger_to_console(ob_log_severity severity, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Logs a message with severity, file, function, and line info.
|
||||
*
|
||||
* @param[in] severity Log level, see @ref ob_log_severity for details
|
||||
* @param[in] module The module or component the log belongs to
|
||||
* @param[in] message Message string to log
|
||||
* @param[in] file Source file name, e.g., __FILE__
|
||||
* @param[in] func Function name, e.g., __func__
|
||||
* @param[in] line Line number, e.g., __LINE__
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during log output setting
|
||||
*/
|
||||
OB_EXPORT void ob_log_external_message(ob_log_severity severity, const char *module, const char *message, const char *file, const char *func, int line,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the extensions directory
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
*
|
||||
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
|
||||
*
|
||||
* @param[in] directory Path to the extensions directory. If the path is empty, extensions path will be set to the current working directory.
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs during extensions directory setting
|
||||
*/
|
||||
OB_EXPORT void ob_set_extensions_directory(const char *directory, ob_error **error);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the host-side timestamp clock type for the current context.
|
||||
*
|
||||
* @attention All ob::Context instances share the same underlying SDK runtime and clock type.
|
||||
* @attention Switching affects frame system and global timestamps; avoid switching during streaming.
|
||||
* @attention It is recommended to synchronize device timestamps after switching.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[in] clock_type The clock type to use for host-side timestamps
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs
|
||||
*/
|
||||
OB_EXPORT void ob_context_set_timestamp_clock_type(ob_context *context, ob_clock_type clock_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current host-side timestamp clock type for the context.
|
||||
*
|
||||
* @param[in] context Pointer to the context object
|
||||
* @param[out] error Pointer to an error object that will be populated if an error occurs
|
||||
*
|
||||
* @return ob_clock_type The current clock type
|
||||
*/
|
||||
OB_EXPORT ob_clock_type ob_context_get_timestamp_clock_type(const ob_context *context, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_enable_multi_device_sync ob_enable_device_clock_sync
|
||||
#define ob_set_logger_callback ob_set_logger_to_callback
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Error.h
|
||||
* @brief Functions for handling errors, mainly used for obtaining error messages.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a new error object.
|
||||
*
|
||||
* @param[in] status The error status.
|
||||
* @param[in] message The error message.
|
||||
* @param[in] function The name of the API function that caused the error.
|
||||
* @param[in] args The error parameters.
|
||||
* @param[in] exception_type The type of exception that caused the error.
|
||||
*
|
||||
* @return ob_error* The new error object.
|
||||
*/
|
||||
OB_EXPORT ob_error *ob_create_error(ob_status status, const char *message, const char *function, const char *args, ob_exception_type exception_type);
|
||||
|
||||
/**
|
||||
* @brief Get the error status.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The error status.
|
||||
*/
|
||||
OB_EXPORT ob_status ob_error_get_status(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the error message.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The error message.
|
||||
*/
|
||||
OB_EXPORT const char *ob_error_get_message(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the API function that caused the error.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The name of the API function.
|
||||
*/
|
||||
OB_EXPORT const char *ob_error_get_function(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the error parameters.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The error parameters.
|
||||
*/
|
||||
OB_EXPORT const char *ob_error_get_args(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Get the type of exception that caused the error.
|
||||
*
|
||||
* @param[in] error The error object.
|
||||
* @return The type of exception.
|
||||
*/
|
||||
OB_EXPORT ob_exception_type ob_error_get_exception_type(const ob_error *error);
|
||||
|
||||
/**
|
||||
* @brief Delete the error object.
|
||||
*
|
||||
* @param[in] error The error object to delete, you should set the pointer to NULL after calling this function.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_error(ob_error *error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_error_status ob_error_get_status
|
||||
#define ob_error_message ob_error_get_message
|
||||
#define ob_error_function ob_error_get_function
|
||||
#define ob_error_args ob_error_get_args
|
||||
#define ob_error_exception_type ob_error_get_exception_type
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
#ifndef OB_EXPORT_H
|
||||
#define OB_EXPORT_H
|
||||
|
||||
#ifdef OB_STATIC_DEFINE
|
||||
# define OB_EXPORT
|
||||
# define OB_NO_EXPORT
|
||||
#else
|
||||
# ifndef OB_EXPORT
|
||||
# ifdef OrbbecSDK_EXPORTS
|
||||
/* We are building this library */
|
||||
# define OB_EXPORT __attribute__((visibility("default")))
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define OB_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef OB_NO_EXPORT
|
||||
# define OB_NO_EXPORT __attribute__((visibility("hidden")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OB_DEPRECATED
|
||||
# define OB_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifndef OB_DEPRECATED_EXPORT
|
||||
# define OB_DEPRECATED_EXPORT OB_EXPORT OB_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef OB_DEPRECATED_NO_EXPORT
|
||||
# define OB_DEPRECATED_NO_EXPORT OB_NO_EXPORT OB_DEPRECATED
|
||||
#endif
|
||||
|
||||
/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
|
||||
#if 0 /* DEFINE_NO_DEPRECATED */
|
||||
# ifndef OB_NO_DEPRECATED
|
||||
# define OB_NO_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* OB_EXPORT_H */
|
||||
@@ -0,0 +1,283 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Filter.h
|
||||
* @brief The processing unit of the SDK can perform point cloud generation, format conversion and other functions.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a Filter object.
|
||||
*
|
||||
* @attention If the filter of the specified name is a private filter, and the creator of the filter have not been activated, the function will return NULL.
|
||||
*
|
||||
* @param[in] name The name of the filter.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT ob_filter *ob_create_filter(const char *name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the name of ob_filter
|
||||
*
|
||||
* @param[in] filter ob_filter object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return char The filter of name
|
||||
*/
|
||||
OB_EXPORT const char *ob_filter_get_name(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the vendor specific code of a filter by filter name.
|
||||
* @brief A private filter can define its own vendor specific code for specific purposes.
|
||||
*
|
||||
* @param[in] name The name of the filter.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const char* Return the vendor specific code of the filter.
|
||||
*/
|
||||
OB_EXPORT const char *ob_filter_get_vendor_specific_code(const char *name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a private Filter object with activation key.
|
||||
* @brief Some private filters require an activation key to be activated, its depends on the vendor of the filter.
|
||||
*
|
||||
* @param[in] name The name of the filter.
|
||||
* @param[in] activation_key The activation key of the filter.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_filter* Return the private filter object.
|
||||
*/
|
||||
OB_EXPORT ob_filter *ob_create_private_filter(const char *name, const char *activation_key, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Activate a private filter object with a specific device.
|
||||
*
|
||||
* @param[in] filter The private filter object.
|
||||
* @param[in] device The device to associate with the activation.
|
||||
* @param[in] options Optional extensible activation options (may be NULL). See @ref ob_priv_filter_activate_options.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_activate_private_ex(ob_filter *filter, ob_device *device, const ob_priv_filter_activate_options *options, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the filter.
|
||||
*
|
||||
* @param[in] filter The filter object to be deleted.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_filter(ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get config schema of the filter
|
||||
* @brief The returned string is a csv format string representing the configuration schema of the filter. The format of the string is:
|
||||
* `<parameter_name>`, `<parameter_type: "int", "float", "bool">`, `<minimum_value>`, `<maximum_value>`, `<value_step>`, `<default_value>`,
|
||||
* `<parameter_description>`
|
||||
*
|
||||
* @param[in] filter The filter object to get the configuration schema for
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs
|
||||
*
|
||||
* @return A csv format string representing the configuration schema of the filter
|
||||
*/
|
||||
OB_EXPORT const char *ob_filter_get_config_schema(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the filter config schema list of the filter
|
||||
* @brief The returned string is a list of ob_config_schema_item representing the configuration schema of the filter.
|
||||
*
|
||||
* @attention The returned list should be deleted by calling @ref ob_delete_filter_config_schema_list when it is no longer needed.
|
||||
*
|
||||
* @param[in] filter The filter object to get the configuration schema for
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs
|
||||
*
|
||||
* @return ob_filter_config_schema_list* Return the filter config schema list of the filter
|
||||
*/
|
||||
OB_EXPORT ob_filter_config_schema_list *ob_filter_get_config_schema_list(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a list of filter config schema items.
|
||||
*
|
||||
* @param[in] config_schema_list The list of filter config schema items to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_filter_config_schema_list(ob_filter_config_schema_list *config_schema_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Update config of the filter
|
||||
*
|
||||
* @attention The passed in argc and argv must match the configuration schema returned by the @ref ob_filter_get_config_schema function.
|
||||
*
|
||||
* @param[in] filter The filter object to update the configuration for
|
||||
* @param[in] argc The number of arguments in the argv array
|
||||
* @param[in] argv An array of strings representing the configuration values
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs
|
||||
*/
|
||||
OB_EXPORT void ob_filter_update_config(ob_filter *filter, uint8_t argc, const char **argv, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the filter config value by name and cast to double.
|
||||
*
|
||||
* @attention The returned value is cast to double, the actual type of the value depends on the filter config schema returned by @ref
|
||||
* ob_filter_get_config_schema.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] config_name config name
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return double The value of the config.
|
||||
*/
|
||||
OB_EXPORT double ob_filter_get_config_value(const ob_filter *filter, const char *config_name, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the filter config value by name.
|
||||
*
|
||||
* @attention The pass into value type is double, witch will be cast to the actual type inside the filter. The actual type can be queried by the filter config
|
||||
* schema returned by @ref ob_filter_get_config_schema.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] config_name config name
|
||||
* @param[in] value The value to set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_set_config_value(ob_filter *filter, const char *config_name, double value, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Reset the filter, clears the cache, and resets the state. If the asynchronous interface is used, the processing thread will also be stopped and the
|
||||
* pending cache frames will be cleared.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_reset(ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable the frame post processing
|
||||
* @brief The filter default is enable.
|
||||
*
|
||||
* @attention If the filter has been disabled by calling this function, processing will directly output a clone of the input frame.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] enable enable status, true: enable; false: disable.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_enable(ob_filter *filter, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the enable status of the frame post processing
|
||||
*
|
||||
* @attention If the filter is disabled, the processing will directly output a clone of the input frame.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The post processing filter status. True: enable; False: disable.
|
||||
*/
|
||||
OB_EXPORT bool ob_filter_is_enabled(const ob_filter *filter, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Process the frame (synchronous interface).
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] frame Pointer to the frame object to be processed.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The frame object processed by the filter.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_filter_process(ob_filter *filter, const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the processing result callback function for the filter (asynchronous callback interface).
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] callback Callback function.
|
||||
* @param[in] user_data Arbitrary user data pointer can be passed in and returned from the callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_set_callback(ob_filter *filter, ob_filter_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Push the frame into the pending cache for the filter (asynchronous callback interface).
|
||||
* @brief The frame will be processed by the filter when the processing thread is available and return a new processed frame to the callback function.
|
||||
*
|
||||
* @attention The frame object will be add reference count, so the user still need call @ref ob_delete_frame to release the frame after calling this function.
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] frame Pointer to the frame object to be processed.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_filter_push_frame(ob_filter *filter, const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of filter in the list
|
||||
*
|
||||
* @param[in] filter_list filter list
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t The number of list
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_filter_list_get_count(const ob_filter_list *filter_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the filter by index
|
||||
*
|
||||
* @param[in] filter_list Filter list
|
||||
* @param[in] index Filter index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_filter The index of ob_filter
|
||||
*/
|
||||
OB_EXPORT ob_filter *ob_filter_list_get_filter(const ob_filter_list *filter_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a list of ob_filter objects.
|
||||
*
|
||||
* @param[in] filter_list The list of ob_filter objects to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_filter_list(ob_filter_list *filter_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of config schema items in the config schema list
|
||||
*
|
||||
* @param[in] config_schema_list Filter config schema list
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t The number of config schema items in the filter list
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_filter_config_schema_list_get_count(const ob_filter_config_schema_list *config_schema_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the config schema item by index
|
||||
*
|
||||
* @param[in] config_schema_list Filter config schema list
|
||||
* @param[in] index Config schema item index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_filter_config_schema_item* The config schema item by index
|
||||
*/
|
||||
OB_EXPORT ob_filter_config_schema_item ob_filter_config_schema_list_get_item(const ob_filter_config_schema_list *config_schema_list, uint32_t index,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the align to stream profile for the align filter.
|
||||
* @brief It is useful when the align target stream dose not started (without any frame to get intrinsics and extrinsics).
|
||||
*
|
||||
* @param[in] filter A filter object.
|
||||
* @param[in] align_to_stream_profile The align target stream profile.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_align_filter_set_align_to_stream_profile(ob_filter *filter, const ob_stream_profile *align_to_stream_profile, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_get_filter ob_filter_list_get_filter
|
||||
#define ob_get_filter_name ob_filter_get_name
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,715 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Frame.h
|
||||
* @brief Frame related function is mainly used to obtain frame data and frame information
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Crate a frame object based on the specified parameters.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type The frame object type.
|
||||
* @param[in] format The frame object format.
|
||||
* @param[in] data_size The size of the frame object data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame(ob_frame_type frame_type, ob_format format, uint32_t data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create (clone) a frame object based on the specified other frame object.
|
||||
* @brief The new frame object will have the same properties as the other frame object, but the data buffer is newly allocated.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] other_frame The frame object to create the new frame object according to.
|
||||
* @param[in] should_copy_data If true, the data of the source frame object will be copied to the new frame object. If false, the new frame object will
|
||||
* have a data buffer with random data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the new frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame_from_other_frame(const ob_frame *other_frame, bool should_copy_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a frame object according to the specified stream profile.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no logger needed.
|
||||
*
|
||||
* @param[in] stream_profile The stream profile to create the new frame object according to.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the new frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame_from_stream_profile(const ob_stream_profile *stream_profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create an video frame object based on the specified parameters.
|
||||
*
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type Frame object type.
|
||||
* @param[in] format Frame object format.
|
||||
* @param[in] width Frame object width.
|
||||
* @param[in] height Frame object height.
|
||||
* @param[in] stride_bytes Row span in bytes. If 0, the stride is calculated based on the width and format.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return an empty frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_video_frame(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a frame object based on an externally created buffer.
|
||||
*
|
||||
* @attention The buffer is owned by the user and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type Frame object type.
|
||||
* @param[in] format Frame object format.
|
||||
* @param[in] buffer Frame object buffer.
|
||||
* @param[in] buffer_size Frame object buffer size.
|
||||
* @param[in] buffer_destroy_cb Destroy callback, will be called when the frame object is destroyed.
|
||||
* @param[in] buffer_destroy_context Destroy context, user-defined context to be passed to the destroy callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint8_t *buffer, uint32_t buffer_size,
|
||||
ob_frame_destroy_callback *buffer_destroy_cb, void *buffer_destroy_context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a video frame object based on an externally created buffer.
|
||||
*
|
||||
* @attention The buffer is owned by the user and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
|
||||
* @attention The frame object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it is
|
||||
* no longer needed.
|
||||
*
|
||||
* @param[in] frame_type Frame object type.
|
||||
* @param[in] format Frame object format.
|
||||
* @param[in] width Frame object width.
|
||||
* @param[in] height Frame object height.
|
||||
* @param[in] stride_bytes Row span in bytes. If 0, the stride is calculated based on the width and format.
|
||||
* @param[in] buffer Frame object buffer.
|
||||
* @param[in] buffer_size Frame object buffer size.
|
||||
* @param[in] buffer_destroy_cb Destroy callback, user-defined function to destroy the buffer.
|
||||
* @param[in] buffer_destroy_context Destroy context, user-defined context to be passed to the destroy callback.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_video_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes,
|
||||
uint8_t *buffer, uint32_t buffer_size, ob_frame_destroy_callback *buffer_destroy_cb,
|
||||
void *buffer_destroy_context, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create an empty frameset object.
|
||||
* @brief A frameset object is a special type of frame object that can be used to store multiple frames.
|
||||
*
|
||||
* @attention The frameset object is created with a reference count of 1, and the reference count should be decreased by calling @ref ob_delete_frame() when it
|
||||
* is no longer needed.
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_frame* Return the frameset object.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_create_frameset(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Increase the reference count of a frame object.
|
||||
* @brief The reference count is used to manage the lifetime of the frame object.
|
||||
*
|
||||
* @attention When calling this function, the reference count of the frame object is
|
||||
* increased and requires to be decreased by calling @ref ob_delete_frame().
|
||||
*
|
||||
* @param[in] frame Frame object to increase the reference count.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_add_ref(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a frame object
|
||||
* @brief This function will decrease the reference count of the frame object and release the memory if the reference count becomes 0.
|
||||
*
|
||||
* @param[in] frame The frame object to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_frame(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Copy the information of the source frame object to the destination frame object.
|
||||
* @brief Including the index, timestamp, system timestamp, global timestamp and metadata will be copied.
|
||||
*
|
||||
* @param[in] src_frame Source frame object to copy the information from.
|
||||
* @param[in] dst_frame Destination frame object to copy the information to.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_copy_info(const ob_frame *src_frame, ob_frame *dst_frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame index
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Log wrong message
|
||||
*
|
||||
* @return uint64_t return the frame index
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_index(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame format
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_format return the frame format
|
||||
*/
|
||||
OB_EXPORT ob_format ob_frame_get_format(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame type
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame_type return the frame type
|
||||
*/
|
||||
OB_EXPORT ob_frame_type ob_frame_get_type(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame timestamp (also known as device timestamp, hardware timestamp) of the frame in microseconds.
|
||||
* @brief The hardware timestamp is the time point when the frame was captured by the device (Typically in the mid-exposure, unless otherwise stated), on device
|
||||
* clock domain.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint64_t return the frame hardware timestamp in microseconds
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_timestamp_us(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the frame timestamp (also known as the device timestamp, hardware timestamp) of a frame object.
|
||||
*
|
||||
* @param[in] frame Frame object to set the timestamp.
|
||||
* @param[in] timestamp_us frame timestamp to set in microseconds.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_set_timestamp_us(ob_frame *frame, uint64_t timestamp_us, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the system timestamp of the frame in microseconds.
|
||||
* @brief The system timestamp is the time point when the frame was received by the host, on host clock domain.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint64_t return the frame system timestamp in microseconds
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_system_timestamp_us(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the system timestamp of the frame in microseconds.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[in] system_timestamp_us frame system timestamp to set in microseconds.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_set_system_timestamp_us(ob_frame *frame, uint64_t system_timestamp_us, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the global timestamp of the frame in microseconds.
|
||||
* @brief The global timestamp is the time point when the frame was captured by the device, and has been converted to the host clock domain. The
|
||||
* conversion process base on the frame timestamp and can eliminate the timer drift of the device
|
||||
*
|
||||
* @attention The global timestamp is disabled by default. If global timestamp is not enabled, the function will return 0. To enable it, call @ref
|
||||
* ob_device_enable_global_timestamp() function.
|
||||
* @attention Only some models of device support getting the global timestamp. Check the device support status by @ref
|
||||
* ob_device_is_global_timestamp_supported() function.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint64_t The global timestamp of the frame in microseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_global_timestamp_us(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the data buffer of a frame.
|
||||
*
|
||||
* @attention The returned data buffer is mutable, but it is not recommended to modify it directly. Modifying the data directly may cause issues if the frame is
|
||||
* being used in other threads or future use. If you need to modify the data, it is recommended to create a new frame object.
|
||||
*
|
||||
* @param[in] frame The frame object from which to retrieve the data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint8_t* Pointer to the frame data buffer.
|
||||
*/
|
||||
OB_EXPORT uint8_t *ob_frame_get_data(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Update the data of a frame.
|
||||
* @brief The data will be memcpy to the frame data buffer.
|
||||
* @brief The frame data size will be also updated as the input data size.
|
||||
*
|
||||
* @attention It is not recommended to update the frame data if the frame was not created by the user. If you must update it, ensure that the frame is not being
|
||||
* used in other threads.
|
||||
* @attention The size of the new data should be equal to or less than the current data size of the frame. Exceeding the original size may cause memory
|
||||
* exceptions.
|
||||
*
|
||||
* @param[in] frame The frame object to update.
|
||||
* @param[in] data The new data to update the frame with.
|
||||
* @param[in] data_size The size of the new data.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_update_data(ob_frame *frame, const uint8_t *data, uint32_t data_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame data size
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame data size
|
||||
* If it is point cloud data, it return the number of bytes occupied by all point sets. If you need to find the number of points, you need to divide dataSize
|
||||
* by the structure size of the corresponding point type.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_frame_get_data_size(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the metadata of the frame
|
||||
*
|
||||
* @attention The returned metadata is mutable, but it is not recommended to modify it directly. Modifying the metadata directly may cause issues if the frame
|
||||
* is being used in other threads or future use. If you need to modify the metadata, it is recommended to create a new frame object.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return const uint8_t * return the metadata pointer of the frame
|
||||
*/
|
||||
OB_EXPORT uint8_t *ob_frame_get_metadata(const ob_frame *frame, ob_error **error);
|
||||
#define ob_video_frame_metadata ob_frame_get_metadata // for compatibility
|
||||
|
||||
/**
|
||||
* @brief Get the metadata size of the frame
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the metadata size of the frame
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_frame_get_metadata_size(const ob_frame *frame, ob_error **error);
|
||||
#define ob_video_frame_metadata_size ob_frame_get_metadata_size // for compatibility
|
||||
|
||||
/**
|
||||
* @brief Update the metadata of the frame
|
||||
* @brief The metadata will be memcpy to the frame metadata buffer.
|
||||
* @brief The frame metadata size will be also updated as the input metadata size.
|
||||
*
|
||||
* @attention It is not recommended to update the frame metadata if the frame was not created by the user. If you must update it, ensure that the frame is not
|
||||
* being used in other threads or future use.
|
||||
* @attention The metadata size should be equal to or less than 256 bytes, otherwise it will cause memory exception.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] metadata The new metadata to update.
|
||||
* @param[in] metadata_size The size of the new metadata.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_update_metadata(ob_frame *frame, const uint8_t *metadata, uint32_t metadata_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief check if the frame contains the specified metadata
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] type metadata type, refer to @ref ob_frame_metadata_type
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT bool ob_frame_has_metadata(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the metadata value of the frame
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] type metadata type, refer to @ref ob_frame_metadata_type
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return int64_t return the metadata value of the frame
|
||||
*/
|
||||
OB_EXPORT int64_t ob_frame_get_metadata_value(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile of the frame
|
||||
*
|
||||
* @attention Require @ref ob_delete_stream_profile() to release the return stream profile.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_stream_profile* Return the stream profile of the frame, if the frame is not captured by a sensor stream, it will return NULL
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_frame_get_stream_profile(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set (override) the stream profile of the frame
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[in] stream_profile The stream profile to set for the frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_set_stream_profile(ob_frame *frame, const ob_stream_profile *stream_profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sensor of the frame
|
||||
*
|
||||
* @attention Require @ref ob_delete_sensor() to release the return sensor.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_sensor* return the sensor of the frame, if the frame is not captured by a sensor or the sensor stream has been destroyed, it will return NULL
|
||||
*/
|
||||
OB_EXPORT ob_sensor *ob_frame_get_sensor(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device of the frame
|
||||
*
|
||||
* @attention Require @ref ob_delete_device() to release the return device.
|
||||
*
|
||||
* @param[in] frame frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* return the device of the frame, if the frame is not captured by a sensor stream or the device has been destroyed, it will return NULL
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_frame_get_device(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the auth token carried by the frame.
|
||||
*
|
||||
* @param[in] frame Frame object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint64_t The auth token value.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_frame_get_token(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the auth token carried by the frame.
|
||||
*
|
||||
* @param[in] frame Frame object.
|
||||
* @param[in] token The auth token value.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frame_set_token(ob_frame *frame, uint64_t token, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device information attached to the frame.
|
||||
*
|
||||
* @param[in] frame Frame object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device_info* Return the attached device information, or NULL if not available.
|
||||
*/
|
||||
OB_EXPORT ob_device_info *ob_frame_get_device_info(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get video frame width
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame width
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_frame_get_width(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get video frame height
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame height
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_frame_get_height(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get video frame pixel format
|
||||
* @brief Usually used to determine the pixel type of depth frame (depth, disparity, raw phase, etc.)
|
||||
*
|
||||
* @attention Always return OB_PIXEL_UNKNOWN for non-depth frame currently if user has not set the pixel type by @ref ob_video_frame_set_pixel_type()
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_pixel_type return the pixel format of the frame.
|
||||
*/
|
||||
OB_EXPORT ob_pixel_type ob_video_frame_get_pixel_type(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set video frame pixel format
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[in] pixel_type the pixel format of the frame
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_frame_set_pixel_type(ob_frame *frame, ob_pixel_type pixel_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effective bits, and the upper 6 bits are filled with 0)
|
||||
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
|
||||
*
|
||||
* @param[in] frame video frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint8_t return the effective number of pixels in the pixel, or 0 if it is an unsupported format
|
||||
*/
|
||||
OB_EXPORT uint8_t ob_video_frame_get_pixel_available_bit_size(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effective bits, and the upper 6 bits are filled with 0)
|
||||
* @attention Only valid for Y8/Y10/Y11/Y12/Y14/Y16 format
|
||||
*
|
||||
* @param[in] frame video frame object
|
||||
* @param[in] bit_size the effective number of pixels in the pixel, or 0 if it is an unsupported format
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_frame_set_pixel_available_bit_size(ob_frame *frame, uint8_t bit_size, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale to give a depth value in millimeters.
|
||||
* For example, if valueScale=0.1 and a certain coordinate pixel value is pixelValue=10000, then the depth value = pixelValue*valueScale = 10000*0.1=1000mm.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float The value scale of the depth frame
|
||||
*/
|
||||
OB_EXPORT float ob_depth_frame_get_value_scale(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale to give a depth value in millimeters.
|
||||
* For example, if valueScale=0.1 and a certain coordinate pixel value is pixelValue=10000, then the depth value = pixelValue*valueScale = 10000*0.1=1000mm.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[in] value_scale The value scale of the depth frame
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_depth_frame_set_value_scale(ob_frame *frame, float value_scale, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the point coordinate value scale of the points frame. The point position value of the points frame is multiplied by the scale to give a position
|
||||
* value in millimeters. For example, if scale=0.1, the x-coordinate value of a point is x = 10000, which means that the actual x-coordinate value = x*scale =
|
||||
* 10000*0.1 = 1000mm.
|
||||
*
|
||||
* @param[in] frame Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float The coordinate value scale of the points frame
|
||||
*/
|
||||
OB_EXPORT float ob_points_frame_get_coordinate_value_scale(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get accelerometer frame data.
|
||||
*
|
||||
* @param[in] frame Accelerometer frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_accel_value Return the accelerometer data.
|
||||
*/
|
||||
OB_EXPORT ob_accel_value ob_accel_frame_get_value(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the temperature when acquiring the accelerometer frame.
|
||||
*
|
||||
* @param[in] frame Accelerometer frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float Return the temperature value.
|
||||
*/
|
||||
OB_EXPORT float ob_accel_frame_get_temperature(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get gyroscope frame data.
|
||||
*
|
||||
* @param[in] frame Gyroscope frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_gyro_value Return the gyroscope data.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_value ob_gyro_frame_get_value(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the temperature when acquiring the gyroscope frame.
|
||||
*
|
||||
* @param[in] frame Gyroscope frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return float Return the temperature value.
|
||||
*/
|
||||
OB_EXPORT float ob_gyro_frame_get_temperature(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of frames contained in the frameset
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset frameset object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the number of frames
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_frameset_get_count(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the depth frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the depth frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_depth_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the color frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the color frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_color_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the infrared frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the infrared frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_ir_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the point cloud frame.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_points_frame(const ob_frame *frameset, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a frame of a specific type from the frameset.
|
||||
*
|
||||
* @attention The frame returned by this function should call @ref ob_delete_frame() to decrease the reference count when it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[in] frame_type Frame type.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame of the specified type, or nullptr if it does not exist.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_frame(const ob_frame *frameset, ob_frame_type frame_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a frame at a specific index from the FrameSet
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[in] index The index of the frame.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* Return the frame at the specified index, or nullptr if it does not exist.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_frameset_get_frame_by_index(const ob_frame *frameset, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Push a frame to the frameset
|
||||
*
|
||||
* @attention If a frame with same type already exists in the frameset, it will be replaced by the new frame.
|
||||
* @attention The frame push to the frameset will be add reference count, so you still need to call @ref ob_delete_frame() to decrease the reference count when
|
||||
* it is no longer needed.
|
||||
*
|
||||
* @param[in] frameset Frameset object.
|
||||
* @param[in] frame Frame object to push.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame width
|
||||
*
|
||||
* @param[in] frame point cloud Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the point cloud frame width
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_point_cloud_frame_get_width(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame height
|
||||
*
|
||||
* @param[in] frame point cloud Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the point cloud frame height
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_point_cloud_frame_get_height(const ob_frame *frame, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_frame_index ob_frame_get_index
|
||||
#define ob_frame_format ob_frame_get_format
|
||||
#define ob_frame_time_stamp_us ob_frame_get_timestamp_us
|
||||
#define ob_frame_set_device_time_stamp_us ob_frame_set_timestamp_us
|
||||
#define ob_frame_system_time_stamp_us ob_frame_get_system_timestamp_us
|
||||
#define ob_frame_global_time_stamp_us ob_frame_get_global_timestamp_us
|
||||
#define ob_frame_data ob_frame_get_data
|
||||
#define ob_frame_data_size ob_frame_get_data_size
|
||||
#define ob_frame_metadata ob_frame_get_metadata
|
||||
#define ob_frame_metadata_size ob_frame_get_metadata_size
|
||||
#define ob_video_frame_width ob_video_frame_get_width
|
||||
#define ob_video_frame_height ob_video_frame_get_height
|
||||
#define ob_video_frame_pixel_available_bit_size ob_video_frame_get_pixel_available_bit_size
|
||||
#define ob_points_frame_get_position_value_scale ob_points_frame_get_coordinate_value_scale
|
||||
#define ob_frameset_frame_count ob_frameset_get_count
|
||||
#define ob_frameset_depth_frame ob_frameset_get_depth_frame
|
||||
#define ob_frameset_color_frame ob_frameset_get_color_frame
|
||||
#define ob_frameset_ir_frame ob_frameset_get_ir_frame
|
||||
#define ob_frameset_points_frame ob_frameset_get_points_frame
|
||||
#define ob_accel_frame_value ob_accel_frame_get_value
|
||||
#define ob_accel_frame_temperature ob_accel_frame_get_temperature
|
||||
#define ob_gyro_frame_value ob_gyro_frame_get_value
|
||||
#define ob_gyro_frame_temperature ob_gyro_frame_get_temperature
|
||||
#define ob_frameset_get_frame_count ob_frameset_get_count
|
||||
|
||||
#define ob_frame_time_stamp(frame, err) (ob_frame_get_timestamp_us(frame, err) / 1000)
|
||||
#define ob_frame_system_time_stamp(frame, err) (ob_frame_get_system_timestamp_us(frame, err))
|
||||
#define ob_frame_set_system_time_stamp(frame, system_timestamp, err) (ob_frame_set_system_timestamp_us(frame, system_timestamp * 1000, err))
|
||||
#define ob_frame_set_device_time_stamp(frame, device_timestamp, err) (ob_frame_set_timestamp_us(frame, device_timestamp * 1000, err))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,131 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file MultipleDevices.h
|
||||
* @brief This file contains the multiple devices related API witch is used to control the synchronization between multiple devices and the synchronization
|
||||
* between different sensor within single device.
|
||||
* @brief The synchronization between multiple devices is complex, and different models have different synchronization modes and limitations. please refer to
|
||||
* the product manual for details.
|
||||
* @brief As the Depth and Infrared are the same sensor physically, the behavior of the Infrared is same as the Depth in the synchronization mode.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
#include "Device.h"
|
||||
|
||||
/**
|
||||
* @brief Get the supported multi device sync mode bitmap of the device.
|
||||
* @brief For example, if the return value is 0b00001100, it means the device supports @ref OB_MULTI_DEVICE_SYNC_MODE_PRIMARY and @ref
|
||||
* OB_MULTI_DEVICE_SYNC_MODE_SECONDARY. User can check the supported mode by the code:
|
||||
* ```c
|
||||
* if(supported_mode_bitmap & OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN){
|
||||
* //support OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN
|
||||
* }
|
||||
* if(supported_mode_bitmap & OB_MULTI_DEVICE_SYNC_MODE_STANDALONE){
|
||||
* //support OB_MULTI_DEVICE_SYNC_MODE_STANDALONE
|
||||
* }
|
||||
* // and so on
|
||||
* ```
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint16_t return the supported multi device sync mode bitmap of the device.
|
||||
*/
|
||||
OB_EXPORT uint16_t ob_device_get_supported_multi_device_sync_mode_bitmap(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief set the multi device sync configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[in] config The multi device sync configuration.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_multi_device_sync_config(ob_device *device, const ob_multi_device_sync_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief get the current multi device sync configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_multi_device_sync_config return the multi device sync configuration of the device.
|
||||
*/
|
||||
OB_EXPORT ob_multi_device_sync_config ob_device_get_multi_device_sync_config(const ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief send the capture command to the device to trigger the capture.
|
||||
* @brief The device will start one time capture after receiving the capture command when it is in the @ref OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING
|
||||
*
|
||||
* @attention The frequency of the user call this function multiplied by the number of frames per trigger should be less than the frame rate of the stream. The
|
||||
* number of frames per trigger can be set by @ref ob_multi_device_sync_config::framesPerTrigger.
|
||||
* @attention For some models, receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling this
|
||||
* function should not be too high, please refer to the product manual for the specific supported frequency.
|
||||
* @attention If the device is not in the @ref OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING mode, device will ignore the capture command.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_trigger_capture(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief set the timestamp reset configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[in] config The timestamp reset configuration.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_set_timestamp_reset_config(ob_device *device, const ob_device_timestamp_reset_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief get the timestamp reset configuration of the device.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device_timestamp_reset_config return the timestamp reset configuration of the device.
|
||||
*/
|
||||
OB_EXPORT ob_device_timestamp_reset_config ob_device_get_timestamp_reset_config(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief send the timestamp reset command to the device.
|
||||
* @brief The device will reset the timer for calculating the timestamp for output frames to 0 after receiving the timestamp reset command when the timestamp
|
||||
* reset function is enabled. The timestamp reset function can be enabled by call @ref ob_device_set_timestamp_reset_config.
|
||||
*
|
||||
* @attention If the stream of the device is started, the timestamp of the continuous frames output by the stream will jump once after the timestamp reset.
|
||||
* @attention Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User
|
||||
* can call this function periodically to reset the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_timestamp_reset(ob_device *device, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Alias for @ref ob_device_timestamp_reset since it is more accurate.
|
||||
*/
|
||||
#define ob_device_timer_reset ob_device_timestamp_reset
|
||||
|
||||
/**
|
||||
* @brief synchronize the timer of the device with the host.
|
||||
* @brief After calling this function, the timer of the device will be synchronized with the host. User can call this function to multiple devices to
|
||||
* synchronize all timers of the devices.
|
||||
*
|
||||
* @attention If the stream of the device is started, the timestamp of the continuous frames output by the stream will may jump once after the timer sync.
|
||||
* @attention Due to the timer of device is not high-accuracy, the timestamp of the continuous frames output by the stream will drift after a long time. User
|
||||
* can call this function periodically to synchronize the timer to avoid the timestamp drift, the recommended interval time is 60 minutes.
|
||||
*
|
||||
* @param[in] device The device handle.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_device_timer_sync_with_host(ob_device *device, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,411 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Pipeline.h
|
||||
* @brief The SDK's advanced API can quickly implement functions such as switching streaming, frame synchronization, software filtering, etc., suitable for
|
||||
* applications, and the algorithm focuses on rgbd data stream scenarios. If you are on real-time or need to handle synchronization separately, align the scene.
|
||||
* Please use the interface of Device's Lower API.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a pipeline object
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_pipeline* return the pipeline object
|
||||
*/
|
||||
OB_EXPORT ob_pipeline *ob_create_pipeline(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Using device objects to create pipeline objects
|
||||
*
|
||||
* @param[in] dev Device object used to create pipeline
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_pipeline* return the pipeline object
|
||||
*/
|
||||
OB_EXPORT ob_pipeline *ob_create_pipeline_with_device(const ob_device *dev, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete pipeline objects
|
||||
*
|
||||
* @param[in] pipeline The pipeline object to be deleted
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_pipeline(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline with default parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_start(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline with configuration parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config Parameters to be configured
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_start_with_config(ob_pipeline *pipeline, const ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline and set the frame collection data callback
|
||||
*
|
||||
* @attention After start the pipeline with this interface, the frames will be output to the callback function and cannot be obtained frames by call
|
||||
* @ref ob_pipeline_wait_for_frameset
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config Parameters to be configured
|
||||
* @param[in] callback Trigger a callback when all frame data in the frameset arrives
|
||||
* @param[in] user_data Pass in any user data and get it from the callback
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_start_with_callback(ob_pipeline *pipeline, const ob_config *config, ob_frameset_callback callback, void *user_data,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Stop pipeline
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_stop(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the configuration object associated with the pipeline
|
||||
* @brief Returns default configuration if the user has not configured
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_config* The configuration object
|
||||
*/
|
||||
OB_EXPORT ob_config *ob_pipeline_get_config(const ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch the corresponding configuration
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] config The pipeline configuration
|
||||
* @param[out] error Log error messages
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_switch_config(ob_pipeline *pipeline, ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Wait for a set of frames to be returned synchronously
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] timeout_ms The timeout for waiting (in milliseconds)
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_frame* The frameset that was waited for. A frameset is a special frame that can be used to obtain independent frames from the set.
|
||||
*/
|
||||
OB_EXPORT ob_frame *ob_pipeline_wait_for_frameset(ob_pipeline *pipeline, uint32_t timeout_ms, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the device object associated with the pipeline
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_device* The device object
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_pipeline_get_device(const ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile list associated with the pipeline
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] sensorType The sensor type. The supported sensor types can be obtained through the ob_device_get_sensor_list() interface.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile_list* The stream profile list
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_pipeline_get_stream_profile_list(const ob_pipeline *pipeline, ob_sensor_type sensorType, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable frame synchronization
|
||||
* @brief Synchronize the frames of different streams by using the timestamp information of the frames.
|
||||
* @brief Dynamically (when pipeline is started) enable/disable frame synchronization is allowed.
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_enable_frame_sync(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Disable frame synchronization
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_disable_frame_sync(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Return a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] color_profile The input profile of the color sensor
|
||||
* @param[in] align_mode The input align mode
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile_list* The list of D2C-enabled depth sensor resolutions
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_get_d2c_depth_profile_list(const ob_pipeline *pipeline, const ob_stream_profile *color_profile, ob_align_mode align_mode,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create the pipeline configuration
|
||||
*
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_config* The configuration object
|
||||
*/
|
||||
OB_EXPORT ob_config *ob_create_config(ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the pipeline configuration
|
||||
*
|
||||
* @param[in] config The configuration to be deleted
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_config(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable a stream with default profile
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] stream_type The type of the stream to be enabled
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_stream(ob_config *config, ob_stream_type stream_type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable all streams in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration
|
||||
* @param[out] error Log error messages
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_all_stream(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable a stream according to the stream profile
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] profile The stream profile to be enabled
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_stream_with_stream_profile(ob_config *config, const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable video stream with specified parameters
|
||||
*
|
||||
* @attention The stream_type should be a video stream type, such as OB_STREAM_IR, OB_STREAM_COLOR, OB_STREAM_DEPTH, etc.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] stream_type The type of the stream to be enabled
|
||||
* @param[in] width The width of the video stream
|
||||
* @param[in] height The height of the video stream
|
||||
* @param[in] fps The frame rate of the video stream
|
||||
* @param[in] format The format of the video stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_video_stream(ob_config *config, ob_stream_type stream_type, uint32_t width, uint32_t height, uint32_t fps, ob_format format,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream using a decimation configuration.
|
||||
*
|
||||
* @attention The stream_type should be a video stream type, such as OB_STREAM_IR, OB_STREAM_DEPTH, etc.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] stream_type The type of the stream to be enabled
|
||||
* @param[in] decimation_config The decimation configuration for the stream
|
||||
* @param[in] fps The frame rate of the video stream
|
||||
* @param[in] format The format of the video stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_video_stream_by_decimation_config(ob_config *config, ob_stream_type stream_type,
|
||||
ob_hardware_decimation_config decimation_config, uint32_t fps, ob_format format,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable accelerometer stream with specified parameters
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] full_scale_range The full scale range of the accelerometer
|
||||
* @param[in] sample_rate The sample rate of the accelerometer
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_accel_stream(ob_config *config, ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable gyroscope stream with specified parameters
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] full_scale_range The full scale range of the gyroscope
|
||||
* @param[in] sample_rate The sample rate of the gyroscope
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_gyro_stream(ob_config *config, ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable LiDAR stream with specified parameters
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] scan_rate The scan rate of LiDAR
|
||||
* @param[in] format The format of the LiDAR stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_enable_lidar_stream(ob_config *config, ob_lidar_scan_rate scan_rate, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the enabled stream profile list in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile_list* The enabled stream profile list, should be released by @ref ob_delete_stream_profile_list after use
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_config_get_enabled_stream_profile_list(const ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Disable a specific stream in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] type The type of stream to be disabled
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_disable_stream(ob_config *config, ob_stream_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Disable all streams in the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_disable_all_stream(ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the alignment mode for the pipeline configuration
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] mode The alignment mode to be set
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_set_align_mode(ob_config *config, ob_align_mode mode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set whether depth scaling is required after enable depth to color alignment
|
||||
* @brief After enabling depth to color alignment, the depth image may need to be scaled to match the color image size.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] enable Whether scaling is required
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_set_depth_scale_after_align_require(ob_config *config, bool enable, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the frame aggregation output mode for the pipeline configuration
|
||||
* @brief The processing strategy when the FrameSet generated by the frame aggregation function does not contain the frames of all opened streams (which
|
||||
* can be caused by different frame rates of each stream, or by the loss of frames of one stream): drop directly or output to the user.
|
||||
*
|
||||
* @param[in] config The pipeline configuration object
|
||||
* @param[in] mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION)
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_config_set_frame_aggregate_output_mode(ob_config *config, ob_frame_aggregate_output_mode mode, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get current camera parameters
|
||||
* @attention If D2C is enabled, it will return the camera parameters after D2C, if not, it will return to the default parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_camera_param The camera internal parameters
|
||||
*/
|
||||
OB_EXPORT ob_camera_param ob_pipeline_get_camera_param(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current camera parameters
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] colorWidth color width
|
||||
* @param[in] colorHeight color height
|
||||
* @param[in] depthWidth depth width
|
||||
* @param[in] depthHeight depth height
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_camera_param returns camera internal parameters
|
||||
*/
|
||||
OB_EXPORT ob_camera_param ob_pipeline_get_camera_param_with_profile(ob_pipeline *pipeline, uint32_t colorWidth, uint32_t colorHeight, uint32_t depthWidth,
|
||||
uint32_t depthHeight, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device calibration parameters with the specified configuration
|
||||
*
|
||||
* @param[in] pipeline pipeline object
|
||||
* @param[in] config The pipeline configuration
|
||||
* @param[out] error Log error messages
|
||||
*
|
||||
* @return ob_calibration_param The calibration parameters
|
||||
*/
|
||||
OB_EXPORT ob_calibration_param ob_pipeline_get_calibration_param(ob_pipeline *pipeline, ob_config *config, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current pipeline status observed during streaming.
|
||||
*
|
||||
* @note This function returns the accumulated status since the last call or since the pipeline was (re)started.
|
||||
* The status is reset after each call. It is recommended to call this when no frames have been received
|
||||
* for a period of time. If the status indicates a data error or no-frame condition, the SDK will also
|
||||
* attempt to fetch device and driver status (with throttling to avoid excessive device communication).
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_pipeline_status Pipeline status reflecting events observed since the previous call.
|
||||
*/
|
||||
OB_EXPORT ob_pipeline_status ob_pipeline_get_status(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Enable pipeline health monitor with periodic status polling.
|
||||
*
|
||||
* @note When enabled, an internal polling thread will periodically check the pipeline status (including SDK frame
|
||||
* drops, device error state, and driver status). If any abnormal status is detected, the callback will be
|
||||
* invoked. The callback is invoked from an internal thread; avoid blocking operations in the callback.
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[in] callback The callback function to be invoked when abnormal status is detected
|
||||
* @param[in] user_data User-defined data passed to the callback
|
||||
* @param[in] interval_ms Polling interval in milliseconds (recommended: 3000-5000)
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_enable_health_monitor(ob_pipeline *pipeline, ob_pipeline_status_callback callback, void *user_data, uint32_t interval_ms,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Disable pipeline health monitor.
|
||||
*
|
||||
* @param[in] pipeline The pipeline object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_pipeline_disable_health_monitor(ob_pipeline *pipeline, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_config_set_depth_scale_require ob_config_set_depth_scale_after_align_require
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
|
||||
record and playback streaming data, etc.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
/**
|
||||
* @brief Create a recording device for the specified device with a specified file path and compression enabled.
|
||||
*
|
||||
* @param[in] device The device to record.
|
||||
* @param[in] file_path The file path to record to.
|
||||
* @param[in] compression_enabled Whether to enable compression for the recording.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return A pointer to the newly created recording device, or NULL if an error occurred.
|
||||
*/
|
||||
OB_EXPORT ob_record_device *ob_create_record_device(ob_device *device, const char *file_path, bool compression_enabled, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_record_device(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Pause recording on the specified recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to pause.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_record_device_pause(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Resume recording on the specified recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to resume.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_record_device_resume(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a playback device for the specified file path.
|
||||
*
|
||||
* @param[in] file_path The file path to playback from.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return A pointer to the newly created playback device, or NULL if an error occurred.
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_create_playback_device(const char *file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Pause playback on the specified playback device.
|
||||
*
|
||||
* @param[in] player The playback device to pause.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_pause(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Resume playback on the specified playback device.
|
||||
*
|
||||
* @param[in] player The playback device to resume.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_resume(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the playback to a specified time point of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to set the position for.
|
||||
* @param[in] timestamp The position to set the playback to, in milliseconds.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_seek(ob_device *player, const uint64_t timestamp, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the playback to a specified time point of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to set the position for.
|
||||
* @param[in] rate The playback rate to set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_set_playback_rate(ob_device *player, const float rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current playback status of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the status for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The current playback status of the played data.
|
||||
*/
|
||||
OB_EXPORT ob_playback_status ob_playback_device_get_current_playback_status(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a callback function to receive playback status updates.
|
||||
*
|
||||
* @param[in] player The playback device to set the callback for.
|
||||
* @param[in] callback The callback function to receive playback status updates.
|
||||
* @param[in] user_data Pointer to user data that can be passed to and retrieved from the callback function
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_set_playback_status_changed_callback(ob_device *player, ob_playback_status_changed_callback callback, void *user_data,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current playback position of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the position for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The current playback position of the played data, in milliseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_playback_device_get_position(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the duration of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the duration for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The duration of the played data, in milliseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_playback_device_get_duration(ob_device *player, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
@@ -0,0 +1,138 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Sensor.h
|
||||
* @brief Defines types related to sensors, used for obtaining stream configurations, opening and closing streams, and setting and getting sensor properties.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Get the type of the sensor.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor type.
|
||||
*/
|
||||
OB_EXPORT ob_sensor_type ob_sensor_get_type(const ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a list of all supported stream profiles.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return A list of stream profiles.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile_list *ob_sensor_get_stream_profile_list(const ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Open the current sensor and set the callback data frame.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[in] profile The stream configuration information.
|
||||
* @param[in] callback The callback function triggered when frame data arrives.
|
||||
* @param[in] user_data Any user data to pass in and get from the callback.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_sensor_start(ob_sensor *sensor, const ob_stream_profile *profile, ob_frame_callback callback, void *user_data, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Stop the sensor stream.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_sensor_stop(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Switch resolutions.
|
||||
*
|
||||
* @param[in] sensor The sensor object.
|
||||
* @param[in] profile The stream configuration information.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_sensor_switch_profile(ob_sensor *sensor, ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a sensor object.
|
||||
*
|
||||
* @param[in] sensor The sensor object to delete.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_sensor(ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a list of recommended filters for the specified sensor.
|
||||
*
|
||||
* @param[in] sensor The ob_sensor object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_filter_list
|
||||
*/
|
||||
OB_EXPORT ob_filter_list *ob_sensor_create_recommended_filter_list(const ob_sensor *sensor, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of sensors in the sensor list.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The number of sensors in the list.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_sensor_list_get_count(const ob_sensor_list *sensor_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sensor type.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[in] index The index of the sensor on the list.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor type.
|
||||
*/
|
||||
OB_EXPORT ob_sensor_type ob_sensor_list_get_sensor_type(const ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by sensor type.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[in] sensorType The sensor type to be obtained.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor pointer. If the specified type of sensor does not exist, it will return null.
|
||||
*/
|
||||
OB_EXPORT ob_sensor *ob_sensor_list_get_sensor_by_type(const ob_sensor_list *sensor_list, ob_sensor_type sensorType, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by index number.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects.
|
||||
* @param[in] index The index of the sensor on the list.
|
||||
* @param[out] error Logs error messages.
|
||||
*
|
||||
* @return The sensor object.
|
||||
*/
|
||||
OB_EXPORT ob_sensor *ob_sensor_list_get_sensor(const ob_sensor_list *sensor_list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a list of sensor objects.
|
||||
*
|
||||
* @param[in] sensor_list The list of sensor objects to delete.
|
||||
* @param[out] error Logs error messages.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_sensor_list(ob_sensor_list *sensor_list, ob_error **error);
|
||||
|
||||
#define ob_sensor_list_get_sensor_count ob_sensor_list_get_count
|
||||
#define ob_sensor_get_recommended_filter_list ob_sensor_create_recommended_filter_list
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,505 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file StreamProfile.h
|
||||
* @brief The stream profile related type is used to get information such as the width, height, frame rate, and format of the stream.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Create a stream profile object
|
||||
*
|
||||
* @param[in] type Stream type
|
||||
* @param[in] format Stream format
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_stream_profile(ob_stream_type type, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a video stream profile object
|
||||
*
|
||||
* @param[in] type Stream type
|
||||
* @param[in] format Stream format
|
||||
* @param[in] width Stream width
|
||||
* @param[in] height Stream height
|
||||
* @param[in] fps Stream frame rate
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the video stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_video_stream_profile(ob_stream_type type, ob_format format, uint32_t width, uint32_t height, uint32_t fps,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a accel stream profile object
|
||||
*
|
||||
* @param[in] full_scale_range Accel full scale range
|
||||
* @param[in] sample_rate Accel sample rate
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the accel stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_accel_stream_profile(ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a gyro stream profile object
|
||||
*
|
||||
* @param[in] full_scale_range Gyro full scale range
|
||||
* @param[in] sample_rate Gyro sample rate
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the gyro stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_gyro_stream_profile(ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a LiDAR stream profile object
|
||||
*
|
||||
* @param[in] scan_rate The scan rate of LiDAR
|
||||
* @param[in] format The format of the LiDAR stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return ob_stream_profile* return the LiDAR stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_lidar_stream_profile(ob_lidar_scan_rate scan_rate, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Copy the stream profile object from an other stream profile object
|
||||
*
|
||||
* @param[in] srcProfile Source stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the new stream profile object
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_stream_profile_from_other_stream_profile(const ob_stream_profile *srcProfile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Copy the stream profile object with a new format object
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] new_format New format
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_profile* return the new stream profile object with the new format
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_create_stream_profile_with_new_format(const ob_stream_profile *profile, ob_format new_format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the stream configuration.
|
||||
*
|
||||
* @param[in] profile Stream profile object .
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_stream_profile(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get stream profile format
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_format return the format of the stream
|
||||
*/
|
||||
OB_EXPORT ob_format ob_stream_profile_get_format(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set stream profile format
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] format The format of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_format(ob_stream_profile *profile, ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get stream profile type
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_stream_type stream type
|
||||
*/
|
||||
OB_EXPORT ob_stream_type ob_stream_profile_get_type(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set stream profile type
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] type The type of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_type(const ob_stream_profile *profile, ob_stream_type type, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the extrinsic for source stream to target stream
|
||||
*
|
||||
* @param[in] source Source stream profile
|
||||
* @param[in] target Target stream profile
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_extrinsic The extrinsic
|
||||
*/
|
||||
OB_EXPORT ob_extrinsic ob_stream_profile_get_extrinsic_to(const ob_stream_profile *source, ob_stream_profile *target, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic for source stream to target stream
|
||||
*
|
||||
* @param[in] source Stream profile object
|
||||
* @param[in] target Target stream type
|
||||
* @param[in] extrinsic The extrinsic
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_extrinsic_to(ob_stream_profile *source, const ob_stream_profile *target, ob_extrinsic extrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic for source stream to target stream type
|
||||
*
|
||||
* @param[in] source Source stream profile
|
||||
* @param[in] type Target stream type
|
||||
* @param[in] extrinsic The extrinsic
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_stream_profile_set_extrinsic_to_type(ob_stream_profile *source, const ob_stream_type type, ob_extrinsic extrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the frame rate of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the frame rate of the stream
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_stream_profile_get_fps(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the width of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the width of the stream
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_stream_profile_get_width(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the width of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[in] width The width of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_width(ob_stream_profile *profile, uint32_t width, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the height of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return uint32_t return the height of the stream
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_video_stream_profile_get_height(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the height of the video stream
|
||||
*
|
||||
* @param[in] profile Stream profile object , If the profile is not a video stream configuration, an error will be returned
|
||||
* @param[in] height The height of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_height(ob_stream_profile *profile, uint32_t height, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_camera_intrinsic Return the intrinsic of the stream
|
||||
*/
|
||||
OB_EXPORT ob_camera_intrinsic ob_video_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] intrinsic The intrinsic of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_camera_intrinsic intrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the distortion of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_camera_distortion Return the distortion of the stream
|
||||
*/
|
||||
OB_EXPORT ob_camera_distortion ob_video_stream_profile_get_distortion(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the decimation configuration of the video stream profile.
|
||||
*
|
||||
* @param[in] profile Stream profile object.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_hardware_decimation_config Return the decimation configuration of the stream.
|
||||
*/
|
||||
OB_EXPORT ob_hardware_decimation_config ob_video_stream_profile_get_decimation_config(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the distortion of the video stream profile
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[in] distortion The distortion of the stream
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_video_stream_profile_set_distortion(ob_stream_profile *profile, ob_camera_distortion distortion, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the process param of the disparity stream
|
||||
*
|
||||
* @param[in] profile Stream profile object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_disparity_param Return the disparity process param of the stream
|
||||
*/
|
||||
OB_EXPORT ob_disparity_param ob_disparity_based_stream_profile_get_disparity_param(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the disparity process param of the disparity stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the disparity stream, an error will be returned.
|
||||
* @param[in] param The disparity process param of the disparity stream.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_disparity_based_stream_profile_set_disparity_param(ob_stream_profile *profile, ob_disparity_param param, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the full-scale range of the accelerometer stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The full-scale range of the accelerometer stream.
|
||||
*/
|
||||
OB_EXPORT ob_accel_full_scale_range ob_accel_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sampling frequency of the accelerometer frame.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The sampling frequency of the accelerometer frame.
|
||||
*/
|
||||
OB_EXPORT ob_accel_sample_rate ob_accel_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic of the accelerometer stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_accel_intrinsic Return the intrinsic of the accelerometer stream.
|
||||
*/
|
||||
OB_EXPORT ob_accel_intrinsic ob_accel_stream_profile_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic of the accelerometer stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the accelerometer stream, an error will be returned.
|
||||
* @param[in] intrinsic The intrinsic of the accelerometer stream.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_accel_stream_profile_set_intrinsic(ob_stream_profile *profile, ob_accel_intrinsic intrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the full-scale range of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The full-scale range of the gyroscope stream.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_full_scale_range ob_gyro_stream_profile_get_full_scale_range(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the sampling frequency of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The sampling frequency of the gyroscope stream.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_sample_rate ob_gyro_stream_profile_get_sample_rate(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return ob_gyro_intrinsic Return the intrinsic of the gyroscope stream.
|
||||
*/
|
||||
OB_EXPORT ob_gyro_intrinsic ob_gyro_stream_get_intrinsic(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic of the gyroscope stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the gyroscope stream, an error will be returned.
|
||||
* @param[in] intrinsic The intrinsic of the gyroscope stream.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_gyro_stream_set_intrinsic(ob_stream_profile *profile, ob_gyro_intrinsic intrinsic, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the scan rate of the LiDAR stream.
|
||||
*
|
||||
* @param[in] profile Stream profile object. If the profile is not for the LiDAR stream, an error will be returned.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return The scan rate of the LiDAR stream.
|
||||
*/
|
||||
OB_EXPORT ob_lidar_scan_rate ob_lidar_stream_profile_get_scan_rate(const ob_stream_profile *profile, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the number of StreamProfile lists.
|
||||
*
|
||||
* @param[in] profile_list StreamProfile list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The number of StreamProfile lists.
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_stream_profile_list_get_count(const ob_stream_profile_list *profile_list, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the corresponding StreamProfile by subscripting.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list StreamProfile lists.
|
||||
* @param[in] index Index.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_profile(const ob_stream_profile_list *profile_list, int index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] width Width. If you don't need to add matching conditions, you can pass OB_WIDTH_ANY.
|
||||
* @param[in] height Height. If you don't need to add matching conditions, you can pass OB_HEIGHT_ANY.
|
||||
* @param[in] format Format. If you don't need to add matching conditions, you can pass OB_FORMAT_ANY.
|
||||
* @param[in] fps Frame rate. If you don't need to add matching conditions, you can pass OB_FPS_ANY.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_video_stream_profile(const ob_stream_profile_list *profile_list, int width, int height,
|
||||
ob_format format, int fps, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile based on the provided decimation configuration. If multiple profiles match, the first profile in the list
|
||||
* is returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be released with @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list The list of stream profiles.
|
||||
* @param[in] decimation_config Decimation configuration. The actual resolution is determined by original resolution and the scale factor.
|
||||
* @param[in] format Stream format. If no matching condition is required, pass OB_FORMAT_ANY.
|
||||
* @param[in] fps Frame rate. If no matching condition is required, pass OB_FPS_ANY.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matched stream profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_video_stream_profile_by_decimation_config(const ob_stream_profile_list *profile_list,
|
||||
ob_hardware_decimation_config decimation_config,
|
||||
ob_format format, int fps, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_accel_stream_profile(const ob_stream_profile_list *profile_list,
|
||||
ob_accel_full_scale_range full_scale_range, ob_accel_sample_rate sample_rate,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] full_scale_range Full-scale range. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[in] sample_rate Sample rate. If you don't need to add matching conditions, you can pass 0.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_gyro_stream_profile(const ob_stream_profile_list *profile_list,
|
||||
ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches,
|
||||
* the first one in the list will be returned by default. If no matched profile is found, an error will be returned.
|
||||
*
|
||||
* @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed.
|
||||
*
|
||||
* @param[in] profile_list Resolution list.
|
||||
* @param[in] scan_rate The scan rate of LiDAR. If you don't need to add matching conditions, you can pass OB_LIDAR_SCAN_ANY.
|
||||
* @param[in] format The format of the LiDAR stream. If you don't need to add matching conditions, you can pass OB_FORMAT_ANY.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return The matching profile.
|
||||
*/
|
||||
OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_lidar_stream_profile(const ob_stream_profile_list *profile_list, ob_lidar_scan_rate scan_rate,
|
||||
ob_format format, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete the stream profile list.
|
||||
*
|
||||
* @param[in] profile_list Stream configuration list.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_stream_profile_list(const ob_stream_profile_list *profile_list, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_stream_profile_format ob_stream_profile_get_format
|
||||
#define ob_stream_profile_type ob_stream_profile_get_type
|
||||
#define ob_video_stream_profile_fps ob_video_stream_profile_get_fps
|
||||
#define ob_video_stream_profile_width ob_video_stream_profile_get_width
|
||||
#define ob_video_stream_profile_height ob_video_stream_profile_get_height
|
||||
#define ob_accel_stream_profile_full_scale_range ob_accel_stream_profile_get_full_scale_range
|
||||
#define ob_accel_stream_profile_sample_rate ob_accel_stream_profile_get_sample_rate
|
||||
#define ob_gyro_stream_profile_full_scale_range ob_gyro_stream_profile_get_full_scale_range
|
||||
#define ob_gyro_stream_profile_sample_rate ob_gyro_stream_profile_get_sample_rate
|
||||
#define ob_stream_profile_list_count ob_stream_profile_list_get_count
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Convert OBFormat to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBFormat type.
|
||||
*
|
||||
* @return OBFormat of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_format_type_to_string(OBFormat type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameType type.
|
||||
*
|
||||
* @return OBFrameType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_frame_type_to_string(OBFrameType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBStreamType type.
|
||||
*
|
||||
* @return OBStreamType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_stream_type_to_string(OBStreamType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBSensorType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBSensorType type.
|
||||
*
|
||||
* @return OBSensorType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_sensor_type_to_string(OBSensorType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBIMUSampleRate to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBIMUSampleRate type.
|
||||
*
|
||||
* @return OBIMUSampleRate of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_imu_rate_type_to_string(OBIMUSampleRate type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBIMUSampleRate to its numeric frequency value in Hz.
|
||||
*
|
||||
* @param[in] type OBIMUSampleRate type.
|
||||
*
|
||||
* @return IMU sample rate value in Hz. Returns 0 for unknown values.
|
||||
*/
|
||||
OB_EXPORT float ob_imu_rate_type_to_value(OBIMUSampleRate type);
|
||||
|
||||
/**
|
||||
* @brief Convert a numeric IMU sample rate value in Hz to OBIMUSampleRate.
|
||||
*
|
||||
* @param[in] value IMU sample rate value in Hz.
|
||||
*
|
||||
* @return Matching OBIMUSampleRate. Returns OB_SAMPLE_RATE_UNKNOWN when no exact SDK rate matches.
|
||||
*/
|
||||
OB_EXPORT OBIMUSampleRate ob_imu_rate_value_to_type(float value);
|
||||
|
||||
/**
|
||||
* @brief Convert OBGyroFullScaleRange to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBGyroFullScaleRange type.
|
||||
*
|
||||
* @return OBGyroFullScaleRange of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_gyro_range_type_to_string(OBGyroFullScaleRange type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBAccelFullScaleRange to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBAccelFullScaleRange type.
|
||||
*
|
||||
* @return OBAccelFullScaleRange of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_accel_range_type_to_string(OBAccelFullScaleRange type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBLiDARScanRate to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBLiDARScanRate type.
|
||||
* @return OBLiDARScanRate of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char *ob_lidar_scan_rate_type_to_string(OBLiDARScanRate type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameMetadataType to " char* " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameMetadataType type.
|
||||
*
|
||||
* @return OBFrameMetadataType of "char*" type.
|
||||
*/
|
||||
OB_EXPORT const char* ob_meta_data_type_to_string(OBFrameMetadataType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBSensorType to OBStreamType.
|
||||
*
|
||||
* @param[in] type The sensor type to convert.
|
||||
*
|
||||
* @return The corresponding stream type.
|
||||
*/
|
||||
OB_EXPORT OBStreamType ob_sensor_type_to_stream_type(OBSensorType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to OBSensorType.
|
||||
*
|
||||
* @param[in] type The stream type to convert.
|
||||
*
|
||||
* @return The corresponding sensor type.
|
||||
*/
|
||||
OB_EXPORT OBSensorType ob_stream_type_to_sensor_type(OBStreamType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to OBFrameType.
|
||||
*
|
||||
* @param[in] type The stream type to convert.
|
||||
*
|
||||
* @return The corresponding frame type.
|
||||
*/
|
||||
OB_EXPORT OBFrameType ob_stream_type_to_frame_type(OBStreamType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to OBStreamType.
|
||||
*
|
||||
* @param[in] type The frame type to convert.
|
||||
*
|
||||
* @return The corresponding stream type.
|
||||
*/
|
||||
OBStreamType ob_frame_type_to_stream_type(OBFrameType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to OBSensorType.
|
||||
*
|
||||
* @param[in] type The frame type to convert.
|
||||
*
|
||||
* @return The corresponding sensor type.
|
||||
*/
|
||||
OB_EXPORT OBSensorType ob_frame_type_to_sensor_type(OBFrameType type);
|
||||
|
||||
/**
|
||||
* @brief Convert OBFormat to " char* " type and then return.
|
||||
*
|
||||
* @param[in] format The OBFormat to convert.
|
||||
*
|
||||
* @return The string.
|
||||
*/
|
||||
OB_EXPORT const char *ob_format_to_string(OBFormat format);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,136 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ObTypes.h"
|
||||
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_3d_to_3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_2d_to_3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_3d_to_2d(const OBPoint3f source_point3f, const OBCameraIntrinsic target_intrinsic, const OBCameraDistortion target_distortion,
|
||||
OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 2d pixel coordinate of the target camera
|
||||
*
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] source_distortion Source distortion parameters
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_2d_to_2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic,
|
||||
const OBCameraDistortion target_distortion, OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT ob_frame *transformation_depth_frame_to_color_camera(ob_device *device, ob_frame *depth_frame, uint32_t target_color_camera_width,
|
||||
uint32_t target_color_camera_height, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT bool transformation_init_xy_tables(const ob_calibration_param calibration_param, const ob_sensor_type sensor_type, float *data, uint32_t *data_size,
|
||||
ob_xy_tables *xy_tables, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT void transformation_depth_to_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, void *pointcloud_data, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT void transformation_depth_to_rgbd_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, const void *color_image_data,
|
||||
void *pointcloud_data, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_3d_to_3d instead.
|
||||
OB_EXPORT bool ob_calibration_3d_to_3d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
|
||||
const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_2d_to_3d instead.
|
||||
OB_EXPORT bool ob_calibration_2d_to_3d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point3f *target_point3f,
|
||||
ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_3d_to_2d instead.
|
||||
OB_EXPORT bool ob_calibration_3d_to_2d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
|
||||
const ob_sensor_type target_sensor_type, ob_point2f *target_point2f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_2d_to_2d instead.
|
||||
OB_EXPORT bool ob_calibration_2d_to_2d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point2f *target_point2f,
|
||||
ob_error **error);
|
||||
/**
|
||||
* @brief save point cloud to ply file.
|
||||
*
|
||||
* @param[in] file_name Point cloud save path
|
||||
* @param[in] frame Point cloud frame
|
||||
* @param[in] save_binary Binary or textual,true: binary, false: textual
|
||||
* @param[in] use_mesh Save mesh or not, true: save as mesh, false: not save as mesh
|
||||
* @param[in] mesh_threshold Distance threshold for creating faces in point cloud,default value :50
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool save point cloud result
|
||||
*/
|
||||
OB_EXPORT bool ob_save_pointcloud_to_ply(const char *file_name, ob_frame *frame, bool save_binary, bool use_mesh, float mesh_threshold, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief save LiDAR point cloud to ply file.
|
||||
*
|
||||
* @param[in] file_name Point cloud save path
|
||||
* @param[in] frame LiDAR point cloud frame
|
||||
* @param[in] save_binary Binary or textual,true: binary, false: textual
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool save LiDAR point cloud result
|
||||
*/
|
||||
OB_EXPORT bool ob_save_lidar_pointcloud_to_ply(const char *file_name, ob_frame *frame, bool save_binary, ob_error **error);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Version.h
|
||||
* @brief Functions for retrieving the SDK version number information.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get the SDK version number.
|
||||
*
|
||||
* @return int The SDK version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK major version number.
|
||||
*
|
||||
* @return int The SDK major version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_major_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK minor version number.
|
||||
*
|
||||
* @return int The SDK minor version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_minor_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK patch version number.
|
||||
*
|
||||
* @return int The SDK patch version number.
|
||||
*/
|
||||
OB_EXPORT int ob_get_patch_version(void);
|
||||
|
||||
/**
|
||||
* @brief Get the SDK stage version.
|
||||
*
|
||||
* @attention The returned char* does not need to be freed.
|
||||
*
|
||||
* @return const char* The SDK stage version.
|
||||
*/
|
||||
OB_EXPORT const char *ob_get_stage_version(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,404 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Device.hpp"
|
||||
#include "StreamProfile.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "libobsensor/h/Advanced.h"
|
||||
#include "libobsensor/h/ApplicationConfig.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace ob {
|
||||
|
||||
class ApplicationSensorConfig {
|
||||
public:
|
||||
explicit ApplicationSensorConfig(OBSensorType sensorType) : sensorType_(sensorType) {}
|
||||
|
||||
OBSensorType sensorType() const {
|
||||
return sensorType_;
|
||||
}
|
||||
|
||||
void enableStream(bool enabled) {
|
||||
streamEnabled_ = enabled;
|
||||
}
|
||||
|
||||
bool isStreamEnabled() const {
|
||||
return streamEnabled_;
|
||||
}
|
||||
|
||||
void setStreamProfile(const std::shared_ptr<StreamProfile> &profile) {
|
||||
streamProfile_ = profile;
|
||||
}
|
||||
|
||||
std::shared_ptr<StreamProfile> streamProfile() const {
|
||||
return streamProfile_;
|
||||
}
|
||||
|
||||
void enableUndistortion(bool enabled) {
|
||||
undistortionEnabled_ = enabled;
|
||||
}
|
||||
|
||||
bool isUndistortionEnabled() const {
|
||||
return undistortionEnabled_;
|
||||
}
|
||||
|
||||
private:
|
||||
OBSensorType sensorType_{ OB_SENSOR_UNKNOWN };
|
||||
bool streamEnabled_ = { false };
|
||||
std::shared_ptr<StreamProfile> streamProfile_;
|
||||
bool undistortionEnabled_ = { false };
|
||||
};
|
||||
|
||||
class ApplicationPointCloudConfig {
|
||||
public:
|
||||
void enable(bool enabled) {
|
||||
enabled_ = enabled;
|
||||
}
|
||||
|
||||
bool isEnabled() const {
|
||||
return enabled_;
|
||||
}
|
||||
|
||||
void setFormat(OBFormat format) {
|
||||
format_ = format;
|
||||
}
|
||||
|
||||
OBFormat format() const {
|
||||
return format_;
|
||||
}
|
||||
|
||||
void setDecimationFactor(int32_t factor) {
|
||||
decimationFactor_ = factor;
|
||||
}
|
||||
|
||||
int32_t decimationFactor() const {
|
||||
return decimationFactor_;
|
||||
}
|
||||
|
||||
void setAlignMode(OBAlignMode mode) {
|
||||
alignMode_ = mode;
|
||||
}
|
||||
|
||||
OBAlignMode alignMode() const {
|
||||
return alignMode_;
|
||||
}
|
||||
|
||||
void enableFrameSync(bool enabled) {
|
||||
frameSync_ = enabled;
|
||||
}
|
||||
|
||||
bool isFrameSyncEnabled() const {
|
||||
return frameSync_;
|
||||
}
|
||||
|
||||
void setAllFrameTypeRequired(bool enabled) {
|
||||
allFrameTypeRequired_ = enabled;
|
||||
}
|
||||
|
||||
bool isAllFrameTypeRequired() const {
|
||||
return allFrameTypeRequired_;
|
||||
}
|
||||
|
||||
void enableMatchTargetResolution(bool enabled) {
|
||||
matchTargetResolution_ = enabled;
|
||||
}
|
||||
|
||||
bool isMatchTargetResolutionEnabled() const {
|
||||
return matchTargetResolution_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled_{ false };
|
||||
OBFormat format_{ OB_FORMAT_POINT };
|
||||
int32_t decimationFactor_{ 0 };
|
||||
OBAlignMode alignMode_{ ALIGN_DISABLE };
|
||||
bool frameSync_{ false };
|
||||
bool allFrameTypeRequired_{ false };
|
||||
bool matchTargetResolution_{ false };
|
||||
};
|
||||
|
||||
class ApplicationHDRMergeConfig {
|
||||
public:
|
||||
void enable(bool enabled) {
|
||||
enabled_ = enabled;
|
||||
}
|
||||
|
||||
bool isEnabled() const {
|
||||
return enabled_;
|
||||
}
|
||||
|
||||
void enableIR(bool enabled) {
|
||||
enableIRforHDR_ = enabled;
|
||||
}
|
||||
|
||||
bool isIREnabled() const {
|
||||
return enableIRforHDR_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled_{ false };
|
||||
bool enableIRforHDR_{ true };
|
||||
};
|
||||
|
||||
class ApplicationDevDecimationConfig {
|
||||
public:
|
||||
void enable(bool enabled) {
|
||||
enabled_ = enabled;
|
||||
}
|
||||
|
||||
bool isEnabled() const {
|
||||
return enabled_;
|
||||
}
|
||||
|
||||
void setPresetResolutionConfig(const OBPresetResolutionConfig &config) {
|
||||
config_ = config;
|
||||
}
|
||||
|
||||
const OBPresetResolutionConfig &presetResolutionConfig() const {
|
||||
return config_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled_{ false };
|
||||
OBPresetResolutionConfig config_;
|
||||
};
|
||||
|
||||
class ApplicationConfig {
|
||||
public:
|
||||
static bool isSupported(const std::shared_ptr<Device> &device) {
|
||||
ob_error *error = nullptr;
|
||||
auto ret = ob_device_is_application_config_supported(device->getImpl(), &error);
|
||||
Error::handle(&error);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static std::shared_ptr<ApplicationConfig> get(const std::shared_ptr<Device> &device) {
|
||||
ob_error *error = nullptr;
|
||||
auto handle = ob_device_get_application_config(device->getImpl(), &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<ApplicationConfig>(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the application config carried by an externally imported preset, by preset name.
|
||||
* @return nullptr for built-in presets or presets that carry no application config.
|
||||
*/
|
||||
static std::shared_ptr<ApplicationConfig> get(const std::shared_ptr<Device> &device, const std::string &presetName) {
|
||||
ob_error *error = nullptr;
|
||||
auto handle = ob_device_get_application_config_by_preset(device->getImpl(), presetName.c_str(), &error);
|
||||
Error::handle(&error);
|
||||
if(!handle) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<ApplicationConfig>(handle);
|
||||
}
|
||||
|
||||
explicit ApplicationConfig(ob_application_config *handle) : handle_(handle) {}
|
||||
|
||||
~ApplicationConfig() noexcept {
|
||||
if(handle_) {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_application_config(handle_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
}
|
||||
|
||||
ob_application_config *handle() const {
|
||||
return handle_;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
ob_error *error = nullptr;
|
||||
ob_application_config_reset(handle_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<ApplicationSensorConfig>> sensors() const {
|
||||
std::vector<std::shared_ptr<ApplicationSensorConfig>> result;
|
||||
ob_error *error = nullptr;
|
||||
auto count = ob_application_config_get_count(handle_, OB_APP_CONFIG_SENSORS, &error);
|
||||
Error::handle(&error);
|
||||
for(uint32_t i = 0; i < count; ++i) {
|
||||
auto sensorType = static_cast<OBSensorType>(ob_application_config_get_int(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_SENSOR_TYPE, i), &error));
|
||||
Error::handle(&error);
|
||||
auto sensorConfig = std::make_shared<ApplicationSensorConfig>(sensorType);
|
||||
// enable
|
||||
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_ENABLED, i), &error);
|
||||
Error::handle(&error);
|
||||
sensorConfig->enableStream(enable);
|
||||
// profile
|
||||
auto profile = ob_application_config_get_profile(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_PROFILE, i), &error);
|
||||
Error::handle(&error);
|
||||
sensorConfig->setStreamProfile(StreamProfileFactory::create(profile));
|
||||
result.emplace_back(sensorConfig);
|
||||
// undistortion
|
||||
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_UNDISTORTION_ENABLED, i), &error);
|
||||
Error::handle(&error, false); // optional
|
||||
sensorConfig->enableUndistortion(enable);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void setSensors(const std::vector<std::shared_ptr<ApplicationSensorConfig>> &sensors) {
|
||||
for(const auto &sensor: sensors) {
|
||||
setSensor(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
void setSensor(const std::shared_ptr<ApplicationSensorConfig> &sensor) {
|
||||
if(!sensor) {
|
||||
return;
|
||||
}
|
||||
ob_error *error = nullptr;
|
||||
auto index = sensorIndex(sensor->sensorType());
|
||||
// enable
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_ENABLED, index), sensor->isStreamEnabled(), &error);
|
||||
Error::handle(&error);
|
||||
// profile
|
||||
auto profile = sensor->streamProfile();
|
||||
if(!profile) {
|
||||
throw std::runtime_error("ApplicationSensorConfig: stream profile must not be null");
|
||||
}
|
||||
ob_application_config_set_profile(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_STREAM_PROFILE, index), profile->getImpl(), &error);
|
||||
Error::handle(&error);
|
||||
// undistortion
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_UNDISTORTION_ENABLED, index), sensor->isUndistortionEnabled(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
std::shared_ptr<ApplicationDevDecimationConfig> deviceDecimation() const {
|
||||
auto cfg = std::make_shared<ApplicationDevDecimationConfig>();
|
||||
ob_error *error = nullptr;
|
||||
// enable
|
||||
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION_ENABLED), &error);
|
||||
Error::handle(&error);
|
||||
cfg->enable(enable);
|
||||
if(enable) {
|
||||
// Preset resolution
|
||||
OBPresetResolutionConfig config{};
|
||||
ob_application_config_get_struct(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION), &config, sizeof(config), &error);
|
||||
Error::handle(&error);
|
||||
cfg->setPresetResolutionConfig(config);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
void setDeviceDecimation(const std::shared_ptr<ApplicationDevDecimationConfig> &config) {
|
||||
if(!config) {
|
||||
return;
|
||||
}
|
||||
ob_error *error = nullptr;
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION_ENABLED), config->isEnabled(), &error);
|
||||
Error::handle(&error);
|
||||
auto presetResConfig = config->presetResolutionConfig();
|
||||
ob_application_config_set_struct(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_DEVICE_DECIMATION), &presetResConfig, sizeof(presetResConfig), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
std::shared_ptr<ApplicationPointCloudConfig> pointCloud() const {
|
||||
auto cfg = std::make_shared<ApplicationPointCloudConfig>();
|
||||
ob_error *error = nullptr;
|
||||
// enable
|
||||
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ENABLED), &error);
|
||||
Error::handle(&error);
|
||||
cfg->enable(enable);
|
||||
// format
|
||||
auto value = ob_application_config_get_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FORMAT), &error);
|
||||
Error::handle(&error);
|
||||
cfg->setFormat(static_cast<OBFormat>(value));
|
||||
// decimation factor
|
||||
value = ob_application_config_get_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_DECIMATION_FACTOR), &error);
|
||||
Error::handle(&error);
|
||||
cfg->setDecimationFactor(value);
|
||||
// align mode
|
||||
value = ob_application_config_get_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALIGN_MODE), &error);
|
||||
Error::handle(&error);
|
||||
cfg->setAlignMode(static_cast<OBAlignMode>(value));
|
||||
// frame sync
|
||||
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FRAME_SYNC), &error);
|
||||
Error::handle(&error);
|
||||
cfg->enableFrameSync(enable);
|
||||
// frame aggregate mode
|
||||
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALL_FRAME_TYPE_REQUIRED), &error);
|
||||
Error::handle(&error);
|
||||
cfg->setAllFrameTypeRequired(enable);
|
||||
// match target resolution
|
||||
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_MATCH_TARGET_RESOLUTION), &error);
|
||||
Error::handle(&error);
|
||||
cfg->enableMatchTargetResolution(enable);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
void setPointCloud(const std::shared_ptr<ApplicationPointCloudConfig> &config) {
|
||||
if(!config) {
|
||||
return;
|
||||
}
|
||||
ob_error *error = nullptr;
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ENABLED), config->isEnabled(), &error);
|
||||
Error::handle(&error);
|
||||
ob_application_config_set_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FORMAT), static_cast<int32_t>(config->format()), &error);
|
||||
Error::handle(&error);
|
||||
ob_application_config_set_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_DECIMATION_FACTOR), config->decimationFactor(), &error);
|
||||
Error::handle(&error);
|
||||
ob_application_config_set_int(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALIGN_MODE), static_cast<int32_t>(config->alignMode()), &error);
|
||||
Error::handle(&error);
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_FRAME_SYNC), config->isFrameSyncEnabled(), &error);
|
||||
Error::handle(&error);
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_ALL_FRAME_TYPE_REQUIRED), config->isAllFrameTypeRequired(), &error);
|
||||
Error::handle(&error);
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_POINTCLOUD_MATCH_TARGET_RESOLUTION), config->isMatchTargetResolutionEnabled(),
|
||||
&error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
std::shared_ptr<ApplicationHDRMergeConfig> hdrMerge() const {
|
||||
auto cfg = std::make_shared<ApplicationHDRMergeConfig>();
|
||||
ob_error *error = nullptr;
|
||||
// enable
|
||||
auto enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_ENABLED), &error);
|
||||
Error::handle(&error);
|
||||
cfg->enable(enable);
|
||||
// IR enable
|
||||
enable = ob_application_config_get_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_IR_ENABLED), &error);
|
||||
Error::handle(&error);
|
||||
cfg->enableIR(enable);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
void setHDRMerge(const std::shared_ptr<ApplicationHDRMergeConfig> &config) {
|
||||
if(!config) {
|
||||
return;
|
||||
}
|
||||
ob_error *error = nullptr;
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_ENABLED), config->isEnabled(), &error);
|
||||
Error::handle(&error);
|
||||
ob_application_config_set_bool(handle_, OB_APP_CONFIG_ITEM(OB_APP_CONFIG_HDR_MERGE_IR_ENABLED), config->isIREnabled(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t sensorIndex(OBSensorType sensorType) const {
|
||||
ob_error *error = nullptr;
|
||||
auto count = ob_application_config_get_count(handle_, OB_APP_CONFIG_SENSORS, &error);
|
||||
Error::handle(&error);
|
||||
for(uint32_t i = 0; i < count; ++i) {
|
||||
auto current = static_cast<OBSensorType>(ob_application_config_get_int(handle_, OB_APP_CONFIG_ARRAY_ITEM(OB_APP_CONFIG_SENSOR_TYPE, i), &error));
|
||||
Error::handle(&error);
|
||||
if(current == sensorType) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
throw std::runtime_error("Application sensor config not found");
|
||||
}
|
||||
|
||||
ob_application_config *handle_ = nullptr;
|
||||
};
|
||||
|
||||
using ApplicationConfigPtr = std::shared_ptr<ApplicationConfig>;
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,424 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Context.hpp
|
||||
* @brief The SDK context class, which serves as the entry point to the underlying SDK. It is used to query device lists, handle device callbacks, and set the
|
||||
* log level.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "libobsensor/h/Context.h"
|
||||
#include "Types.hpp"
|
||||
#include "Error.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <mutex>
|
||||
|
||||
namespace ob {
|
||||
|
||||
// forward declarations
|
||||
class Device;
|
||||
class DeviceInfo;
|
||||
class DeviceList;
|
||||
|
||||
class Context {
|
||||
public:
|
||||
/**
|
||||
* @brief Type definition for the device changed callback function.
|
||||
*
|
||||
* @param[in] removedList The list of removed devices.
|
||||
* @param[in] addedList The list of added devices.
|
||||
*/
|
||||
typedef std::function<void(std::shared_ptr<DeviceList> removedList, std::shared_ptr<DeviceList> addedList)> DeviceChangedCallback;
|
||||
|
||||
/**
|
||||
* @brief Type definition for the log output callback function.
|
||||
*
|
||||
* @param[in] severity The current callback log level.
|
||||
* @param[in] logMsg The log message.
|
||||
*/
|
||||
typedef std::function<void(OBLogSeverity severity, const char *logMsg)> LogCallback;
|
||||
|
||||
struct DeviceChangedCallbackContext {
|
||||
Context *ctx;
|
||||
uint64_t callbackId;
|
||||
DeviceChangedCallback callback;
|
||||
};
|
||||
|
||||
private:
|
||||
ob_context *impl_ = nullptr;
|
||||
std::mutex callbackMtx_;
|
||||
|
||||
std::mutex legacyCallbackMtx_;
|
||||
OBCallbackId legacyCallbackId_ = INVALID_CALLBACK_ID;
|
||||
|
||||
std::unordered_map<OBCallbackId, std::unique_ptr<DeviceChangedCallbackContext>> devChangedCallbacks_;
|
||||
// static LogCallback logCallback_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Context constructor.
|
||||
* @brief The Context class is a management class that describes the runtime of the SDK. It is responsible for applying and releasing resources for the SDK.
|
||||
* The context has the ability to manage multiple devices, enumerate devices, monitor device callbacks, and enable functions such as multi-device
|
||||
* synchronization.
|
||||
*
|
||||
* @param[in] configPath The path to the configuration file. If the path is empty, the default configuration will be used.
|
||||
*/
|
||||
explicit Context(const char *configPath = "") {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_context_with_config(configPath, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Context destructor.
|
||||
*/
|
||||
~Context() noexcept {
|
||||
// delete contex of C API, which will auto unregister all callbacks
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_context(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the host-side timestamp clock type for the current context.
|
||||
*
|
||||
* @attention All ob::Context instances share the same underlying SDK runtime and clock type.
|
||||
* @attention Switching affects frame system and global timestamps; avoid switching during streaming.
|
||||
* @attention It is recommended to synchronize device timestamps after switching.
|
||||
*
|
||||
* @param[in] type The clock type to use for host-side timestamps.
|
||||
*/
|
||||
void setTimestampClockType(OBClockType type) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_context_set_timestamp_clock_type(impl_, type, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current host-side timestamp clock type for the context.
|
||||
*
|
||||
* @return OBClockType The current clock type.
|
||||
*/
|
||||
OBClockType getTimestampClockType() const {
|
||||
ob_error *error = nullptr;
|
||||
auto type = ob_context_get_timestamp_clock_type(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Queries the enumerated device list.
|
||||
*
|
||||
* @return std::shared_ptr<DeviceList> A pointer to the device list class.
|
||||
*/
|
||||
std::shared_ptr<DeviceList> queryDeviceList() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_query_device_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<DeviceList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief enable or disable net device enumeration.
|
||||
* @brief after enable, the net device will be discovered automatically and can be retrieved by @ref queryDeviceList. The default state can be set in the
|
||||
* configuration file.
|
||||
*
|
||||
* @attention Net device enumeration by gvcp protocol, if the device is not in the same subnet as the host, it will be discovered but cannot be connected.
|
||||
*
|
||||
* @param[in] enable true to enable, false to disable
|
||||
*/
|
||||
void enableNetDeviceEnumeration(bool enable) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_enable_net_device_enumeration(impl_, enable, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief "Force" a static IP address configuration in a device identified by its MAC Address.
|
||||
*
|
||||
* @param[in] macAddress MAC address of the network device.
|
||||
* You can obtain it from @ref ob_device_info_get_uid, or specify it manually
|
||||
* in the format xx:xx:xx:xx:xx:xx, where each xx is a two-digit hexadecimal value.
|
||||
* @param[in] config The new IP configuration.
|
||||
* @return bool true if the configuration command was processed successfully, false otherwise.
|
||||
*
|
||||
* @note This applies to all GVCP devices
|
||||
*/
|
||||
bool forceIp(const char *macAddress, const OBNetIpConfig &config) {
|
||||
ob_error *error = nullptr;
|
||||
auto res = ob_force_ip_config(macAddress, config, &error);
|
||||
Error::handle(&error);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the GVCP port scheme used for network device discovery and control.
|
||||
*
|
||||
* @param[in] scheme Target GVCP port scheme.
|
||||
* Thrown exception if the specified scheme is invalid or unsupported.
|
||||
*
|
||||
* @note This change affects only the current session and is not persisted.
|
||||
* @note Switching to a different scheme will force disconnection of all currently connected network devices.
|
||||
*/
|
||||
void setGvcpPortScheme(OBGvcpPortScheme scheme) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_gvcp_port_scheme(impl_, scheme, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current GVCP port scheme.
|
||||
*
|
||||
* @return Current GVCP port scheme.
|
||||
*/
|
||||
OBGvcpPortScheme getGvcpPortScheme() const {
|
||||
ob_error *error = nullptr;
|
||||
auto scheme = ob_get_gvcp_port_scheme(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a network device with the specified IP address and port.
|
||||
*
|
||||
* @param[in] address The IP address, ipv4 only. such as "192.168.1.10"
|
||||
* @param[in] port The port number, currently only support 8090
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
*
|
||||
* @return std::shared_ptr<Device> The created device object.
|
||||
*/
|
||||
std::shared_ptr<Device> createNetDevice(const char *address, uint16_t port, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_create_net_device_ex(impl_, address, port, accessMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the device plug-in callback function.
|
||||
*
|
||||
* @deprecated This function is deprecated. Please use registerDeviceChangedCallback() instead.
|
||||
*
|
||||
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
|
||||
*
|
||||
* @param[in] callback The function triggered when the device is plugged and unplugged.
|
||||
*/
|
||||
void setDeviceChangedCallback(DeviceChangedCallback callback) {
|
||||
std::lock_guard<std::mutex> lock(legacyCallbackMtx_);
|
||||
// remove the last callback first
|
||||
if(legacyCallbackId_ != INVALID_CALLBACK_ID) {
|
||||
unregisterDeviceChangedCallback(legacyCallbackId_);
|
||||
}
|
||||
// register the new callback
|
||||
legacyCallbackId_ = registerDeviceChangedCallback(callback);
|
||||
}
|
||||
|
||||
OBCallbackId registerDeviceChangedCallback(DeviceChangedCallback callback) {
|
||||
ob_error *error = nullptr;
|
||||
auto cbCtxHolder = std::unique_ptr<DeviceChangedCallbackContext>(new DeviceChangedCallbackContext({ this, 0, nullptr }));
|
||||
auto id = ob_register_device_changed_callback(impl_, &Context::deviceChangedCallback, (void *)cbCtxHolder.get(), &error);
|
||||
Error::handle(&error);
|
||||
|
||||
cbCtxHolder->callbackId = id;
|
||||
cbCtxHolder->callback = callback;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(callbackMtx_);
|
||||
devChangedCallbacks_[id] = std::move(cbCtxHolder);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
void unregisterDeviceChangedCallback(OBCallbackId id) {
|
||||
ob_error *error = nullptr;
|
||||
ob_unregister_device_changed_callback(impl_, id, &error);
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(callbackMtx_);
|
||||
if(devChangedCallbacks_.count(id)) {
|
||||
devChangedCallbacks_.erase(id);
|
||||
}
|
||||
}
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
|
||||
*
|
||||
* @param[in] repeatIntervalMsec The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
|
||||
*/
|
||||
void enableDeviceClockSync(uint64_t repeatIntervalMsec) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_enable_device_clock_sync(impl_, repeatIntervalMsec, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Activates synchronization time to all created devices (if supported).
|
||||
*
|
||||
* @param[in] hardwarePPSTime unit:ms.
|
||||
*/
|
||||
void syncDeviceHardwarePPSTime(uint64_t hardwarePPSTime) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_sync_device_hardware_pps_time(impl_, hardwarePPSTime, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Frees idle memory from the internal frame memory pool.
|
||||
* @brief The SDK includes an internal frame memory pool that caches memory allocated for frames received from devices.
|
||||
*/
|
||||
void freeIdleMemory() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_free_idle_memory(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
|
||||
* @brief It is effective when the new device is created.
|
||||
*
|
||||
* @attention This interface is only available for Linux.
|
||||
*
|
||||
* @param[in] type The backend type to be used.
|
||||
*/
|
||||
void setUvcBackendType(OBUvcBackendType type) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_uvc_backend_type(impl_, type, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the level of the global log, which affects both the log level output to the console, output to the file and output the user defined
|
||||
* callback.
|
||||
*
|
||||
* @param[in] severity The log output level.
|
||||
*/
|
||||
static void setLoggerSeverity(OBLogSeverity severity) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_severity(severity, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set log output to a file.
|
||||
*
|
||||
* @param[in] severity The log level output to the file.
|
||||
* @param[in] directory The log file output path. If the path is empty, the existing settings will continue to be used (if the existing configuration is
|
||||
* also empty, the log will not be output to the file).
|
||||
*/
|
||||
static void setLoggerToFile(OBLogSeverity severity, const char *directory) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_to_file(severity, directory, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the log file name for file output
|
||||
*
|
||||
* @param[in] fileName Log file name. Must not be empty.
|
||||
*
|
||||
* @note Other settings, such as log level and output directory, remain unchanged.
|
||||
*/
|
||||
static void setLoggerFileName(const std::string &fileName) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_file_name(fileName.c_str(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set log output to the console.
|
||||
*
|
||||
* @param[in] severity The log level output to the console.
|
||||
*/
|
||||
static void setLoggerToConsole(OBLogSeverity severity) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_logger_to_console(severity, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the logger to callback.
|
||||
*
|
||||
* @param[in] severity The callback log level.
|
||||
* @param[in] callback The callback function.
|
||||
*/
|
||||
static void setLoggerToCallback(OBLogSeverity severity, LogCallback callback) {
|
||||
ob_error *error = nullptr;
|
||||
Context::getLogCallback() = callback;
|
||||
ob_set_logger_to_callback(severity, &Context::logCallback, &Context::getLogCallback(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Logs a message with severity, file, function, and line info.
|
||||
*
|
||||
* @param severity Log level, see @ref OBLogSeverity for details
|
||||
* @param module The module or component the log belongs to
|
||||
* @param message Message string to log
|
||||
* @param file Source file name, e.g., __FILE__
|
||||
* @param func Function name, e.g., __func__
|
||||
* @param line Line number, e.g., __LINE__
|
||||
*/
|
||||
static void logExternalMessage(OBLogSeverity severity, const std::string &module, const std::string &message, const std::string &file,
|
||||
const std::string &func, int line) {
|
||||
ob_error *error = nullptr;
|
||||
ob_log_external_message(severity, module.c_str(), message.c_str(), file.c_str(), func.c_str(), line, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the extensions directory
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
*
|
||||
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
|
||||
*
|
||||
* @param[in] directory Path to the extensions directory. If the path is empty, the existing settings will continue to be used (if the existing
|
||||
*/
|
||||
static void setExtensionsDirectory(const char *directory) {
|
||||
ob_error *error = nullptr;
|
||||
ob_set_extensions_directory(directory, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
private:
|
||||
static void deviceChangedCallback(ob_device_list *removedList, ob_device_list *addedList, void *userData) {
|
||||
auto cbCtx = static_cast<DeviceChangedCallbackContext *>(userData);
|
||||
if(cbCtx && cbCtx->ctx && cbCtx->callbackId != INVALID_CALLBACK_ID) {
|
||||
DeviceChangedCallback callbackCopy;
|
||||
{
|
||||
// preventing the captured variables from being released.
|
||||
std::unique_lock<std::mutex> lock(cbCtx->ctx->callbackMtx_);
|
||||
if(cbCtx->ctx->devChangedCallbacks_.count(cbCtx->callbackId)) {
|
||||
callbackCopy = cbCtx->callback;
|
||||
}
|
||||
}
|
||||
auto removed = std::make_shared<DeviceList>(removedList);
|
||||
auto added = std::make_shared<DeviceList>(addedList);
|
||||
callbackCopy(removed, added);
|
||||
}
|
||||
}
|
||||
|
||||
static void logCallback(OBLogSeverity severity, const char *logMsg, void *userData) {
|
||||
auto cb = static_cast<LogCallback *>(userData);
|
||||
if(cb) {
|
||||
(*cb)(severity, logMsg);
|
||||
}
|
||||
}
|
||||
|
||||
// Lazy initialization of the logcallback_. The purpose is to initialize logcallback_ in .hpp
|
||||
static LogCallback &getLogCallback() {
|
||||
static LogCallback logCallback_ = nullptr;
|
||||
return logCallback_;
|
||||
}
|
||||
|
||||
// for backward compatibility
|
||||
#define enableMultiDeviceSync enableDeviceClockSync
|
||||
};
|
||||
} // namespace ob
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Error.hpp
|
||||
* @brief This file defines the Error class, which describes abnormal errors within the SDK.
|
||||
* Detailed information about the exception can be obtained through this class.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "libobsensor/h/Error.h"
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
class Error : public std::exception {
|
||||
private:
|
||||
ob_error *impl_;
|
||||
|
||||
/**
|
||||
* @brief Construct a new Error object
|
||||
*
|
||||
* @attention This constructor should not be called directly, use the handle() function instead.
|
||||
*
|
||||
* @param[in] error The ob_error object
|
||||
*/
|
||||
explicit Error(ob_error *error) : impl_(error) {};
|
||||
|
||||
Error &operator=(const Error &) = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief A static function to handle the ob_error and throw an exception if needed.
|
||||
*
|
||||
* @param[in,out] error The ob_error pointer to be handled.
|
||||
* @param[in] throw_exception A boolean value to indicate whether to throw an exception or not, the default value is true.
|
||||
*/
|
||||
static void handle(ob_error **error, bool throw_exception = true) {
|
||||
if(!error || !*error) { // no error
|
||||
return;
|
||||
}
|
||||
|
||||
if(throw_exception) {
|
||||
throw Error(*error);
|
||||
}
|
||||
else {
|
||||
ob_delete_error(*error);
|
||||
*error = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destroy the Error object
|
||||
*/
|
||||
~Error() override {
|
||||
if(impl_) {
|
||||
ob_delete_error(impl_);
|
||||
impl_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the error message of the exception.
|
||||
*
|
||||
* @return const char* The error message.
|
||||
*/
|
||||
const char *what() const noexcept override {
|
||||
return impl_->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the exception type of the exception.
|
||||
* @brief Read the comments of the OBExceptionType enum in the libobsensor/h/ObTypes.h file for more information.
|
||||
*
|
||||
* @return OBExceptionType The exception type.
|
||||
*/
|
||||
OBExceptionType getExceptionType() const noexcept {
|
||||
return impl_->exception_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the name of the function where the exception occurred.
|
||||
*
|
||||
* @return const char* The function name.
|
||||
*/
|
||||
const char *getFunction() const noexcept {
|
||||
return impl_->function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the arguments of the function where the exception occurred.
|
||||
*
|
||||
* @return const char* The arguments.
|
||||
*/
|
||||
const char *getArgs() const noexcept {
|
||||
return impl_->args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the error message of the exception.
|
||||
* @brief It is recommended to use the what() function instead.
|
||||
*
|
||||
* @return const char* The error message.
|
||||
*/
|
||||
const char *getMessage() const noexcept {
|
||||
return impl_->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the error status code of the exception.
|
||||
*
|
||||
* @return OBStatus The error status code.
|
||||
*/
|
||||
OBStatus getStatus() const noexcept {
|
||||
return impl_->status;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
const char *getName() const noexcept {
|
||||
return impl_->function;
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,528 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Pipeline.hpp
|
||||
* @brief The SDK's advanced API type can quickly implement switching streaming and frame synchronization
|
||||
* operations.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Frame.hpp"
|
||||
#include "Device.hpp"
|
||||
#include "StreamProfile.hpp"
|
||||
|
||||
#include "libobsensor/h/Pipeline.h"
|
||||
#include "libobsensor/hpp/Types.hpp"
|
||||
#include "libobsensor/hpp/TypeHelper.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
namespace ob {
|
||||
|
||||
/**
|
||||
* @brief Config class for configuring pipeline parameters
|
||||
*
|
||||
* The Config class provides an interface for configuring pipeline parameters.
|
||||
*/
|
||||
class Config {
|
||||
private:
|
||||
ob_config_t *impl_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Config object
|
||||
*/
|
||||
Config() {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_config(&error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
explicit Config(ob_config_t *impl) : impl_(impl) {}
|
||||
|
||||
/**
|
||||
* @brief Destroy the Config object
|
||||
*/
|
||||
~Config() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_config(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
ob_config_t *getImpl() const {
|
||||
return impl_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief enable a stream with a specific stream type
|
||||
*
|
||||
* @param[in] streamType The stream type to be enabled
|
||||
*/
|
||||
void enableStream(OBStreamType streamType) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_stream(impl_, streamType, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a stream with a specific sensor type
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to be enabled
|
||||
*/
|
||||
void enableStream(OBSensorType sensorType) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
enableStream(streamType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a stream to be used in the pipeline
|
||||
*
|
||||
* @param[in] streamProfile The stream configuration to be enabled
|
||||
*/
|
||||
void enableStream(std::shared_ptr<const StreamProfile> streamProfile) const {
|
||||
ob_error *error = nullptr;
|
||||
auto c_stream_profile = streamProfile->getImpl();
|
||||
ob_config_enable_stream_with_stream_profile(impl_, c_stream_profile, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable a video stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default resolution settings.
|
||||
* Users who wish to set custom resolutions should refer to the product manual, as available resolutions vary by camera model.
|
||||
*
|
||||
* @param[in] streamType The video stream type.
|
||||
* @param[in] width The video stream width (default is OB_WIDTH_ANY, which selects the default resolution).
|
||||
* @param[in] height The video stream height (default is OB_HEIGHT_ANY, which selects the default resolution).
|
||||
* @param[in] fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
|
||||
* @param[in] format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableVideoStream(OBStreamType streamType, uint32_t width = OB_WIDTH_ANY, uint32_t height = OB_HEIGHT_ANY, uint32_t fps = OB_FPS_ANY,
|
||||
OBFormat format = OB_FORMAT_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_video_stream(impl_, streamType, width, height, fps, format, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream to be used in the pipeline.
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to be enabled.
|
||||
* @param[in] width The video stream width (default is OB_WIDTH_ANY, which selects the default resolution).
|
||||
* @param[in] height The video stream height (default is OB_HEIGHT_ANY, which selects the default resolution).
|
||||
* @param[in] fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
|
||||
* @param[in] format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableVideoStream(OBSensorType sensorType, uint32_t width = OB_WIDTH_ANY, uint32_t height = OB_HEIGHT_ANY, uint32_t fps = OB_FPS_ANY,
|
||||
OBFormat format = OB_FORMAT_ANY) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
enableVideoStream(streamType, width, height, fps, format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a video stream to be used in the pipeline with decimation configuration.
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to be enabled.
|
||||
* @param[in] decimationConfig The decimation configuration for this stream.
|
||||
* @param[in] fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
|
||||
* @param[in] format The video stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableVideoStream(OBSensorType sensorType, OBHardwareDecimationConfig decimationConfig, uint32_t fps = OB_FPS_ANY,
|
||||
OBFormat format = OB_FORMAT_ANY) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_video_stream_by_decimation_config(impl_, streamType, decimationConfig, fps, format, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable an accelerometer stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable an accelerometer stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default settings.
|
||||
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
|
||||
*
|
||||
* @param[in] fullScaleRange The full-scale range of the accelerometer (default is OB_ACCEL_FULL_SCALE_RANGE_ANY, which selects the default range).
|
||||
* @param[in] sampleRate The sample rate of the accelerometer (default is OB_ACCEL_SAMPLE_RATE_ANY, which selects the default rate).
|
||||
*/
|
||||
void enableAccelStream(OBAccelFullScaleRange fullScaleRange = OB_ACCEL_FULL_SCALE_RANGE_ANY,
|
||||
OBAccelSampleRate sampleRate = OB_ACCEL_SAMPLE_RATE_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_accel_stream(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a gyroscope stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable a gyroscope stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default settings.
|
||||
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
|
||||
*
|
||||
* @param[in] fullScaleRange The full-scale range of the gyroscope (default is OB_GYRO_FULL_SCALE_RANGE_ANY, which selects the default range).
|
||||
* @param[in] sampleRate The sample rate of the gyroscope (default is OB_GYRO_SAMPLE_RATE_ANY, which selects the default rate).
|
||||
*/
|
||||
void enableGyroStream(OBGyroFullScaleRange fullScaleRange = OB_GYRO_FULL_SCALE_RANGE_ANY, OBGyroSampleRate sampleRate = OB_GYRO_SAMPLE_RATE_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_gyro_stream(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a LiDAR stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable a LiDAR stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default settings.
|
||||
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
|
||||
*
|
||||
* @param[in] scanRate The scan rate of the LiDAR (default is OB_LIDAR_SCAN_ANY, which selects the default scan rate).
|
||||
* @param[in] format The stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableLiDARStream(OBLiDARScanRate scanRate = OB_LIDAR_SCAN_ANY, OBFormat format = OB_FORMAT_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_lidar_stream(impl_, scanRate, format, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use enableStream(std::shared_ptr<StreamProfile> streamProfile) instead
|
||||
* @brief Enable all streams to be used in the pipeline
|
||||
*/
|
||||
void enableAllStream() {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_all_stream(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable a stream to be used in the pipeline
|
||||
*
|
||||
* @param[in] streamType The stream configuration to be disabled
|
||||
*/
|
||||
void disableStream(OBStreamType streamType) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_disable_stream(impl_, streamType, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable a sensor stream to be used in the pipeline.
|
||||
* @brief Will convert sensor type to stream type automatically.
|
||||
*
|
||||
* @param[in] sensorType The sensor configuration to be disabled
|
||||
*/
|
||||
void disableStream(OBSensorType sensorType) const {
|
||||
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
|
||||
disableStream(streamType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable all streams to be used in the pipeline
|
||||
*/
|
||||
void disableAllStream() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_disable_all_stream(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the Enabled Stream Profile List
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList>
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getEnabledStreamProfileList() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_config_get_enabled_stream_profile_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the alignment mode
|
||||
*
|
||||
* @param[in] mode The alignment mode
|
||||
*/
|
||||
void setAlignMode(OBAlignMode mode) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_set_align_mode(impl_, mode, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set whether the depth needs to be scaled after setting D2C
|
||||
*
|
||||
* @param[in] enable Whether scaling is required
|
||||
*/
|
||||
void setDepthScaleRequire(bool enable) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_set_depth_scale_after_align_require(impl_, enable, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the frame aggregation output mode for the pipeline configuration
|
||||
* @brief The processing strategy when the FrameSet generated by the frame aggregation function does not contain the frames of all opened streams (which
|
||||
* can be caused by different frame rates of each stream, or by the loss of frames of one stream): drop directly or output to the user.
|
||||
*
|
||||
* @param[in] mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION)
|
||||
*/
|
||||
void setFrameAggregateOutputMode(OBFrameAggregateOutputMode mode) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_set_frame_aggregate_output_mode(impl_, mode, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
};
|
||||
|
||||
class Pipeline {
|
||||
public:
|
||||
/**
|
||||
* @brief FrameSetCallback is a callback function type for frameset data arrival.
|
||||
*
|
||||
* @param[in] frame The returned frameset data
|
||||
*/
|
||||
typedef std::function<void(std::shared_ptr<FrameSet> frame)> FrameSetCallback;
|
||||
|
||||
private:
|
||||
ob_pipeline_t *impl_;
|
||||
FrameSetCallback callback_;
|
||||
std::function<void(OBPipelineStatus status)> statusCallback_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Pipeline is a high-level interface for applications, algorithms related RGBD data streams. Pipeline can provide alignment inside and synchronized
|
||||
* FrameSet. Pipeline() no parameter version, which opens the first device in the list of devices connected to the OS by default. If the application has
|
||||
* obtained the device through the DeviceList, opening the Pipeline() at this time will throw an exception that the device has been created.
|
||||
*/
|
||||
Pipeline() {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_pipeline(&error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Pipeline(std::shared_ptr< Device > device ) Function for multi-device operations. Multiple devices need to be obtained through DeviceList, and the device
|
||||
* and pipeline are bound through this interface.
|
||||
*/
|
||||
explicit Pipeline(std::shared_ptr<Device> device) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_pipeline_with_device(device->getImpl(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destroy the pipeline object
|
||||
*/
|
||||
~Pipeline() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_pipeline(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline with configuration parameters
|
||||
*
|
||||
* @param[in] config The parameter configuration of the pipeline
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config = nullptr) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_t *config_impl = config == nullptr ? nullptr : config->getImpl();
|
||||
ob_pipeline_start_with_config(impl_, config_impl, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the pipeline and set the frameset data callback
|
||||
*
|
||||
* @param[in] config The configuration of the pipeline
|
||||
* @param[in] callback The callback to be triggered when all frame data in the frameset arrives
|
||||
*/
|
||||
void start(std::shared_ptr<Config> config, FrameSetCallback callback) {
|
||||
callback_ = callback;
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_start_with_callback(impl_, config ? config->getImpl() : nullptr, &Pipeline::frameSetCallback, this, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
static void frameSetCallback(ob_frame_t *frameSet, void *userData) {
|
||||
auto pipeline = static_cast<Pipeline *>(userData);
|
||||
pipeline->callback_(std::make_shared<FrameSet>(frameSet));
|
||||
}
|
||||
|
||||
static void healthMonitorCallback(ob_pipeline_status status, void *userData) {
|
||||
auto pipeline = static_cast<Pipeline *>(userData);
|
||||
if(pipeline->statusCallback_) {
|
||||
pipeline->statusCallback_(status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop the pipeline
|
||||
*/
|
||||
void stop() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_stop(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the pipeline configuration parameters
|
||||
* @brief Returns the default configuration if the user has not configured it
|
||||
*
|
||||
* @return std::shared_ptr<Config> The configured parameters
|
||||
*/
|
||||
std::shared_ptr<Config> getConfig() const {
|
||||
ob_error *error = nullptr;
|
||||
auto config = ob_pipeline_get_config(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Config>(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait for frameset
|
||||
*
|
||||
* @param[in] timeoutMs The waiting timeout in milliseconds
|
||||
*
|
||||
* @return std::shared_ptr<FrameSet> The waiting frameset data
|
||||
*/
|
||||
std::shared_ptr<FrameSet> waitForFrameset(uint32_t timeoutMs = 1000) const {
|
||||
ob_error *error = nullptr;
|
||||
auto frameSet = ob_pipeline_wait_for_frameset(impl_, timeoutMs, &error);
|
||||
if(frameSet == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
Error::handle(&error);
|
||||
return std::make_shared<FrameSet>(frameSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the device object
|
||||
*
|
||||
* @return std::shared_ptr<Device> The device object
|
||||
*/
|
||||
std::shared_ptr<Device> getDevice() const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_pipeline_get_device(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile of the specified sensor
|
||||
*
|
||||
* @param[in] sensorType The type of sensor
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> The stream profile list
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getStreamProfileList(OBSensorType sensorType) const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_pipeline_get_stream_profile_list(impl_, sensorType, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the stream profile list of supported depth-to-color alignments
|
||||
*
|
||||
* @param[in] colorProfile The color stream profile, which is the target stream profile for the depth-to-color alignment.
|
||||
* @param[in] alignMode The alignment mode.
|
||||
*
|
||||
* @attention Currently, only ALIGN_D2C_HW_MODE supported. For other align modes, please using the AlignFilter interface.
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> The stream profile list of supported depth-to-color alignments.
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getD2CDepthProfileList(std::shared_ptr<StreamProfile> colorProfile, OBAlignMode alignMode) {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_get_d2c_depth_profile_list(impl_, colorProfile->getImpl(), alignMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turn on frame synchronization
|
||||
*/
|
||||
void enableFrameSync() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_enable_frame_sync(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turn off frame synchronization
|
||||
*/
|
||||
void disableFrameSync() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_disable_frame_sync(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current pipeline status observed during streaming.
|
||||
*
|
||||
* @return OBPipelineStatus The accumulated status since the last call or pipeline start. Status is reset after each call.
|
||||
*/
|
||||
OBPipelineStatus getStatus() const {
|
||||
ob_error *error = nullptr;
|
||||
OBPipelineStatus status = ob_pipeline_get_status(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable pipeline health monitor with periodic status polling.
|
||||
*
|
||||
* @param[in] callback The callback function invoked when abnormal status is detected (from internal thread, avoid blocking).
|
||||
* @param[in] intervalMs Polling interval in milliseconds (recommended: 3000-5000, default: 3000).
|
||||
*/
|
||||
void enableHealthMonitor(std::function<void(OBPipelineStatus status)> callback, uint32_t intervalMs = 3000) {
|
||||
statusCallback_ = callback;
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_enable_health_monitor(impl_, &Pipeline::healthMonitorCallback, this, intervalMs, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disable pipeline health monitor.
|
||||
*/
|
||||
void disableHealthMonitor() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_pipeline_disable_health_monitor(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
|
||||
OBCameraParam getCameraParam() {
|
||||
ob_error *error = nullptr;
|
||||
OBCameraParam cameraParam = ob_pipeline_get_camera_param(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return cameraParam;
|
||||
}
|
||||
|
||||
OBCameraParam getCameraParamWithProfile(uint32_t colorWidth, uint32_t colorHeight, uint32_t depthWidth, uint32_t depthHeight) {
|
||||
ob_error *error = nullptr;
|
||||
OBCameraParam cameraParam = ob_pipeline_get_camera_param_with_profile(impl_, colorWidth, colorHeight, depthWidth, depthHeight, &error);
|
||||
Error::handle(&error);
|
||||
return cameraParam;
|
||||
}
|
||||
|
||||
OBCalibrationParam getCalibrationParam(std::shared_ptr<Config> config) {
|
||||
ob_error *error = nullptr;
|
||||
OBCalibrationParam calibrationParam = ob_pipeline_get_calibration_param(impl_, config->getImpl(), &error);
|
||||
Error::handle(&error);
|
||||
return calibrationParam;
|
||||
}
|
||||
|
||||
std::shared_ptr<FrameSet> waitForFrames(uint32_t timeoutMs = 1000) const {
|
||||
return waitForFrameset(timeoutMs);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,197 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
|
||||
record and playback streaming data, etc.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "libobsensor/h/RecordPlayback.h"
|
||||
#include "libobsensor/hpp/Device.hpp"
|
||||
|
||||
namespace ob {
|
||||
|
||||
typedef std::function<void(OBPlaybackStatus status)> PlaybackStatusChangeCallback;
|
||||
|
||||
class RecordDevice {
|
||||
private:
|
||||
ob_record_device_t *impl_ = nullptr;
|
||||
|
||||
public:
|
||||
explicit RecordDevice(std::shared_ptr<Device> device, const std::string &file, bool compressionEnabled = true) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_record_device(device->getImpl(), file.c_str(), compressionEnabled, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
virtual ~RecordDevice() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_record_device(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
RecordDevice(RecordDevice &&other) noexcept {
|
||||
if(this != &other) {
|
||||
impl_ = other.impl_;
|
||||
other.impl_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RecordDevice &operator=(RecordDevice &&other) noexcept {
|
||||
if(this != &other) {
|
||||
impl_ = other.impl_;
|
||||
other.impl_ = nullptr;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
RecordDevice(const RecordDevice &) = delete;
|
||||
RecordDevice &operator=(const RecordDevice &) = delete;
|
||||
|
||||
public:
|
||||
void pause() {
|
||||
ob_error *error = nullptr;
|
||||
ob_record_device_pause(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
void resume() {
|
||||
ob_error *error = nullptr;
|
||||
ob_record_device_resume(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
};
|
||||
|
||||
class PlaybackDevice : public Device {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a PlaybackDevice for playing back recorded device data.
|
||||
* @param[in] file Path to the playback file.
|
||||
* @param[in] presetPath Path to a preset JSON file to load after device creation. If empty, no preset is loaded.
|
||||
*/
|
||||
explicit PlaybackDevice(const std::string &file, const std::string &presetPath = "") : Device(nullptr) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_playback_device(file.c_str(), &error);
|
||||
Error::handle(&error);
|
||||
|
||||
if(!presetPath.empty()) {
|
||||
loadPresetFromJsonFile(presetPath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~PlaybackDevice() noexcept override = default;
|
||||
|
||||
PlaybackDevice(PlaybackDevice &&other) noexcept : Device(std::move(other)) {}
|
||||
|
||||
PlaybackDevice &operator=(PlaybackDevice &&other) noexcept {
|
||||
Device::operator=(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
PlaybackDevice(const PlaybackDevice &) = delete;
|
||||
PlaybackDevice &operator=(const PlaybackDevice &) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Pause the streaming data from the playback device.
|
||||
*/
|
||||
void pause() {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_pause(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume the streaming data from the playback device.
|
||||
*/
|
||||
void resume() {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_resume(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Seek to a specific timestamp when playing back a recording.
|
||||
* @param[in] timestamp The timestamp to seek to, in milliseconds.
|
||||
*/
|
||||
void seek(const int64_t timestamp) {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_seek(impl_, timestamp, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the playback rate of the playback device.
|
||||
* @param[in] rate The playback rate to set.
|
||||
*/
|
||||
void setPlaybackRate(const float rate) {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_set_playback_rate(impl_, rate, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set a callback function to be called when the playback status changes.
|
||||
* @param[in] callback The callback function to set.
|
||||
*/
|
||||
void setPlaybackStatusChangeCallback(PlaybackStatusChangeCallback callback) {
|
||||
callback_ = callback;
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_set_playback_status_changed_callback(impl_, &PlaybackDevice::playbackStatusCallback, this, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current playback status of the playback device.
|
||||
* @return The current playback status.
|
||||
*/
|
||||
OBPlaybackStatus getPlaybackStatus() const {
|
||||
ob_error *error = nullptr;
|
||||
OBPlaybackStatus status = ob_playback_device_get_current_playback_status(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current position of the playback device.
|
||||
* @return The current position of the playback device, in milliseconds.
|
||||
*/
|
||||
uint64_t getPosition() const {
|
||||
ob_error *error = nullptr;
|
||||
uint64_t position = ob_playback_device_get_position(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the duration of the playback device.
|
||||
* @return The duration of the playback device, in milliseconds.
|
||||
*/
|
||||
uint64_t getDuration() const {
|
||||
ob_error *error = nullptr;
|
||||
uint64_t duration = ob_playback_device_get_duration(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return duration;
|
||||
}
|
||||
|
||||
private:
|
||||
static void playbackStatusCallback(OBPlaybackStatus status, void *userData) {
|
||||
auto *playbackDevice = static_cast<PlaybackDevice *>(userData);
|
||||
if(playbackDevice && playbackDevice->callback_) {
|
||||
playbackDevice->callback_(status);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PlaybackStatusChangeCallback callback_;
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,239 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Sensor.hpp
|
||||
* @brief Defines types related to sensors, which are used to obtain stream configurations, open and close streams, and set and get sensor properties.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "libobsensor/hpp/Filter.hpp"
|
||||
#include "libobsensor/h/Sensor.h"
|
||||
#include "libobsensor/h/Filter.h"
|
||||
#include "Error.hpp"
|
||||
#include "StreamProfile.hpp"
|
||||
#include "Device.hpp"
|
||||
#include "Frame.hpp"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace ob {
|
||||
|
||||
class Sensor {
|
||||
public:
|
||||
/**
|
||||
* @brief Callback function for frame data.
|
||||
*
|
||||
* @param[in] frame The frame data.
|
||||
*/
|
||||
typedef std::function<void(std::shared_ptr<Frame> frame)> FrameCallback;
|
||||
|
||||
protected:
|
||||
ob_sensor_t *impl_;
|
||||
FrameCallback callback_;
|
||||
|
||||
public:
|
||||
explicit Sensor(ob_sensor_t *impl) : impl_(impl) {}
|
||||
|
||||
Sensor(Sensor &&sensor) noexcept : impl_(sensor.impl_) {
|
||||
sensor.impl_ = nullptr;
|
||||
}
|
||||
|
||||
Sensor &operator=(Sensor &&sensor) noexcept {
|
||||
if(this != &sensor) {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_sensor(impl_, &error);
|
||||
Error::handle(&error);
|
||||
impl_ = sensor.impl_;
|
||||
sensor.impl_ = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Sensor(const Sensor &sensor) = delete;
|
||||
Sensor &operator=(const Sensor &sensor) = delete;
|
||||
|
||||
virtual ~Sensor() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_sensor(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the sensor type.
|
||||
*
|
||||
* @return OBSensorType The sensor type.
|
||||
*/
|
||||
OBSensorType getType() const {
|
||||
ob_error *error = nullptr;
|
||||
auto type = ob_sensor_get_type(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the list of stream profiles.
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfileList> The stream profile list.
|
||||
*/
|
||||
std::shared_ptr<StreamProfileList> getStreamProfileList() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_sensor_get_stream_profile_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<StreamProfileList>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a list of recommended filters for the sensor.
|
||||
*
|
||||
* @return OBFilterList list of frame processing block
|
||||
*/
|
||||
std::vector<std::shared_ptr<Filter>> createRecommendedFilters() const {
|
||||
ob_error *error = nullptr;
|
||||
auto list = ob_sensor_create_recommended_filter_list(impl_, &error);
|
||||
Error::handle(&error);
|
||||
auto filter_count = ob_filter_list_get_count(list, &error);
|
||||
|
||||
std::vector<std::shared_ptr<Filter>> filters;
|
||||
for(uint32_t i = 0; i < filter_count; i++) {
|
||||
auto filterImpl = ob_filter_list_get_filter(list, i, &error);
|
||||
Error::handle(&error);
|
||||
filters.push_back(std::make_shared<Filter>(filterImpl));
|
||||
}
|
||||
ob_delete_filter_list(list, &error);
|
||||
Error::handle(&error, false);
|
||||
return filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Open a frame data stream and set up a callback.
|
||||
*
|
||||
* @param[in] streamProfile The stream configuration.
|
||||
* @param[in] callback The callback to set when frame data arrives.
|
||||
*/
|
||||
void start(std::shared_ptr<StreamProfile> streamProfile, FrameCallback callback) {
|
||||
ob_error *error = nullptr;
|
||||
callback_ = std::move(callback);
|
||||
ob_sensor_start(impl_, const_cast<ob_stream_profile_t *>(streamProfile->getImpl()), &Sensor::frameCallback, this, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Stop the stream.
|
||||
*/
|
||||
void stop() const {
|
||||
ob_error *error = nullptr;
|
||||
ob_sensor_stop(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Dynamically switch resolutions.
|
||||
*
|
||||
* @param[in] streamProfile The resolution to switch to.
|
||||
*/
|
||||
void switchProfile(std::shared_ptr<StreamProfile> streamProfile) {
|
||||
ob_error *error = nullptr;
|
||||
ob_sensor_switch_profile(impl_, const_cast<ob_stream_profile_t *>(streamProfile->getImpl()), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
private:
|
||||
static void frameCallback(ob_frame *frame, void *userData) {
|
||||
auto sensor = static_cast<Sensor *>(userData);
|
||||
sensor->callback_(std::make_shared<Frame>(frame));
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBSensorType type() const {
|
||||
return getType();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Filter>> getRecommendedFilters() const {
|
||||
return createRecommendedFilters();
|
||||
}
|
||||
};
|
||||
|
||||
class SensorList {
|
||||
private:
|
||||
ob_sensor_list_t *impl_ = nullptr;
|
||||
|
||||
public:
|
||||
explicit SensorList(ob_sensor_list_t *impl) : impl_(impl) {}
|
||||
|
||||
~SensorList() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_sensor_list(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the number of sensors.
|
||||
*
|
||||
* @return uint32_t The number of sensors.
|
||||
*/
|
||||
uint32_t getCount() const {
|
||||
ob_error *error = nullptr;
|
||||
auto count = ob_sensor_list_get_count(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the type of the specified sensor.
|
||||
*
|
||||
* @param[in] index The sensor index.
|
||||
*
|
||||
* @return OBSensorType The sensor type.
|
||||
*/
|
||||
OBSensorType getSensorType(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
auto type = ob_sensor_list_get_sensor_type(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by index number.
|
||||
*
|
||||
* @param[in] index The sensor index. The range is [0, count-1]. If the index exceeds the range, an exception will be thrown.
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> The sensor object.
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
auto sensor = ob_sensor_list_get_sensor(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Sensor>(sensor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a sensor by sensor type.
|
||||
*
|
||||
* @param[in] sensorType The sensor type to obtain.
|
||||
*
|
||||
* @return std::shared_ptr<Sensor> A sensor object. If the specified sensor type does not exist, it will return empty.
|
||||
*/
|
||||
std::shared_ptr<Sensor> getSensor(OBSensorType sensorType) const {
|
||||
ob_error *error = nullptr;
|
||||
auto sensor = ob_sensor_list_get_sensor_by_type(impl_, sensorType, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Sensor>(sensor);
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
uint32_t count() const {
|
||||
return getCount();
|
||||
}
|
||||
|
||||
OBSensorType type(uint32_t index) const {
|
||||
return getSensorType(index);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
|
||||
@@ -0,0 +1,603 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file StreamProfile.hpp
|
||||
* @brief The stream profile related type is used to get information such as the width, height, frame rate, and format of the stream.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "libobsensor/h/StreamProfile.h"
|
||||
#include "libobsensor/h/Error.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
|
||||
class StreamProfile : public std::enable_shared_from_this<StreamProfile> {
|
||||
protected:
|
||||
const ob_stream_profile_t *impl_ = nullptr;
|
||||
|
||||
public:
|
||||
StreamProfile(StreamProfile &streamProfile) = delete;
|
||||
StreamProfile &operator=(StreamProfile &streamProfile) = delete;
|
||||
|
||||
StreamProfile(StreamProfile &&streamProfile) noexcept : impl_(streamProfile.impl_) {
|
||||
streamProfile.impl_ = nullptr;
|
||||
}
|
||||
|
||||
StreamProfile &operator=(StreamProfile &&streamProfile) noexcept {
|
||||
if(this != &streamProfile) {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_stream_profile(impl_, &error);
|
||||
Error::handle(&error);
|
||||
impl_ = streamProfile.impl_;
|
||||
streamProfile.impl_ = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~StreamProfile() noexcept {
|
||||
if(impl_) {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_stream_profile(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
}
|
||||
|
||||
const ob_stream_profile *getImpl() const {
|
||||
return impl_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the format of the stream.
|
||||
*
|
||||
* @return OBFormat return the format of the stream.
|
||||
*/
|
||||
OBFormat getFormat() const {
|
||||
ob_error *error = nullptr;
|
||||
auto format = ob_stream_profile_get_format(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return format;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the type of stream.
|
||||
*
|
||||
* @return OBStreamType return the type of the stream.
|
||||
*/
|
||||
OBStreamType getType() const {
|
||||
ob_error *error = nullptr;
|
||||
auto type = ob_stream_profile_get_type(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the extrinsic parameters from current stream profile to the given target stream profile.
|
||||
*
|
||||
* @return OBExtrinsic Return the extrinsic parameters.
|
||||
*/
|
||||
OBExtrinsic getExtrinsicTo(std::shared_ptr<StreamProfile> target) const {
|
||||
ob_error *error = nullptr;
|
||||
auto extrinsic = ob_stream_profile_get_extrinsic_to(impl_, const_cast<ob_stream_profile_t *>(target->getImpl()), &error);
|
||||
Error::handle(&error);
|
||||
return extrinsic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic parameters from current stream profile to the given target stream profile.
|
||||
*
|
||||
* @tparam target Target stream profile.
|
||||
* @tparam extrinsic The extrinsic.
|
||||
*/
|
||||
void bindExtrinsicTo(std::shared_ptr<StreamProfile> target, const OBExtrinsic &extrinsic) {
|
||||
ob_error *error = nullptr;
|
||||
ob_stream_profile_set_extrinsic_to(const_cast<ob_stream_profile_t *>(impl_), const_cast<const ob_stream_profile_t *>(target->getImpl()), extrinsic,
|
||||
&error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the extrinsic parameters from current stream profile to the given target stream type.
|
||||
*
|
||||
* @tparam targetStreamType Target stream type.
|
||||
* @tparam extrinsic The extrinsic.
|
||||
*/
|
||||
void bindExtrinsicTo(const OBStreamType &targetStreamType, const OBExtrinsic &extrinsic) {
|
||||
ob_error *error = nullptr;
|
||||
ob_stream_profile_set_extrinsic_to_type(const_cast<ob_stream_profile_t *>(impl_), targetStreamType, extrinsic, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if frame object is compatible with the given type.
|
||||
*
|
||||
* @tparam T Given type.
|
||||
*
|
||||
* @return bool return result.
|
||||
*/
|
||||
template <typename T> bool is() const;
|
||||
|
||||
/**
|
||||
* @brief Converts object type to target type.
|
||||
*
|
||||
* @tparam T Target type.
|
||||
*
|
||||
* @return std::shared_ptr<T> Return the result. Throws an exception if conversion is not possible.
|
||||
*/
|
||||
template <typename T> std::shared_ptr<T> as() {
|
||||
if(!is<T>()) {
|
||||
throw std::runtime_error("Unsupported operation. Object's type is not the required type.");
|
||||
}
|
||||
|
||||
return std::dynamic_pointer_cast<T>(shared_from_this());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Converts object type to target type (const version).
|
||||
*
|
||||
* @tparam T Target type.
|
||||
*
|
||||
* @return std::shared_ptr<T> Return the result. Throws an exception if conversion is not possible.
|
||||
*/
|
||||
template <typename T> std::shared_ptr<const T> as() const {
|
||||
if(!is<T>()) {
|
||||
throw std::runtime_error("Unsupported operation. Object's type is not the required type.");
|
||||
}
|
||||
|
||||
return std::static_pointer_cast<const T>(shared_from_this());
|
||||
}
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBFormat format() const {
|
||||
return getFormat();
|
||||
}
|
||||
|
||||
OBStreamType type() const {
|
||||
return getType();
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit StreamProfile(const ob_stream_profile_t *impl) : impl_(impl) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing a video stream profile.
|
||||
*/
|
||||
class VideoStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit VideoStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~VideoStreamProfile() noexcept override = default;
|
||||
|
||||
/**
|
||||
* @brief Return the frame rate of the stream.
|
||||
*
|
||||
* @return uint32_t Return the frame rate of the stream.
|
||||
*/
|
||||
uint32_t getFps() const {
|
||||
ob_error *error = nullptr;
|
||||
auto fps = ob_video_stream_profile_get_fps(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return fps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the width of the stream.
|
||||
*
|
||||
* @return uint32_t Return the width of the stream.
|
||||
*/
|
||||
uint32_t getWidth() const {
|
||||
ob_error *error = nullptr;
|
||||
auto width = ob_video_stream_profile_get_width(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the height of the stream.
|
||||
*
|
||||
* @return uint32_t Return the height of the stream.
|
||||
*/
|
||||
uint32_t getHeight() const {
|
||||
ob_error *error = nullptr;
|
||||
auto height = ob_video_stream_profile_get_height(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the intrinsic parameters of the stream.
|
||||
*
|
||||
* @return OBCameraIntrinsic Return the intrinsic parameters.
|
||||
*/
|
||||
OBCameraIntrinsic getIntrinsic() const {
|
||||
ob_error *error = nullptr;
|
||||
auto intrinsic = ob_video_stream_profile_get_intrinsic(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return intrinsic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the intrinsic parameters of the stream.
|
||||
*
|
||||
* @param[in] intrinsic The intrinsic parameters.
|
||||
*/
|
||||
void setIntrinsic(const OBCameraIntrinsic &intrinsic) {
|
||||
ob_error *error = nullptr;
|
||||
ob_video_stream_profile_set_intrinsic(const_cast<ob_stream_profile_t *>(impl_), intrinsic, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the distortion parameters of the stream.
|
||||
* @brief Brown distortion model
|
||||
*
|
||||
* @return OBCameraDistortion Return the distortion parameters.
|
||||
*/
|
||||
OBCameraDistortion getDistortion() const {
|
||||
ob_error *error = nullptr;
|
||||
auto distortion = ob_video_stream_profile_get_distortion(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return distortion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the distortion parameters of the stream.
|
||||
*
|
||||
* @param[in] distortion The distortion parameters.
|
||||
*/
|
||||
void setDistortion(const OBCameraDistortion &distortion) {
|
||||
ob_error *error = nullptr;
|
||||
ob_video_stream_profile_set_distortion(const_cast<ob_stream_profile_t *>(impl_), distortion, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the decimation configuration of the stream.
|
||||
* Includes original resolution and scale factor.
|
||||
*
|
||||
* @return OBHardwareDecimationConfig Return the decimation configuration.
|
||||
*/
|
||||
OBHardwareDecimationConfig getDecimationConfig() const {
|
||||
ob_error *error = nullptr;
|
||||
auto decimationConfig = ob_video_stream_profile_get_decimation_config(const_cast<ob_stream_profile_t *>(impl_), &error);
|
||||
Error::handle(&error);
|
||||
return decimationConfig;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
uint32_t fps() const {
|
||||
return getFps();
|
||||
}
|
||||
|
||||
uint32_t width() const {
|
||||
return getWidth();
|
||||
}
|
||||
|
||||
uint32_t height() const {
|
||||
return getHeight();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing an accelerometer stream profile.
|
||||
*/
|
||||
class AccelStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit AccelStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~AccelStreamProfile() noexcept override = default;
|
||||
|
||||
/**
|
||||
* @brief Return the full scale range.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the scale range value.
|
||||
*/
|
||||
OBAccelFullScaleRange getFullScaleRange() const {
|
||||
ob_error *error = nullptr;
|
||||
auto fullScaleRange = ob_accel_stream_profile_get_full_scale_range(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return fullScaleRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the sampling frequency.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the sampling frequency.
|
||||
*/
|
||||
OBAccelSampleRate getSampleRate() const {
|
||||
ob_error *error = nullptr;
|
||||
auto sampleRate = ob_accel_stream_profile_get_sample_rate(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the intrinsic parameters of the stream.
|
||||
*
|
||||
* @return OBAccelIntrinsic Return the intrinsic parameters.
|
||||
*/
|
||||
OBAccelIntrinsic getIntrinsic() const {
|
||||
ob_error *error = nullptr;
|
||||
auto intrinsic = ob_accel_stream_profile_get_intrinsic(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return intrinsic;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBAccelFullScaleRange fullScaleRange() const {
|
||||
return getFullScaleRange();
|
||||
}
|
||||
|
||||
OBAccelSampleRate sampleRate() const {
|
||||
return getSampleRate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing a gyroscope stream profile.
|
||||
*/
|
||||
class GyroStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit GyroStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~GyroStreamProfile() noexcept override = default;
|
||||
|
||||
/**
|
||||
* @brief Return the full scale range.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the scale range value.
|
||||
*/
|
||||
OBGyroFullScaleRange getFullScaleRange() const {
|
||||
ob_error *error = nullptr;
|
||||
auto fullScaleRange = ob_gyro_stream_profile_get_full_scale_range(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return fullScaleRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the sampling frequency.
|
||||
*
|
||||
* @return OBAccelFullScaleRange Return the sampling frequency.
|
||||
*/
|
||||
OBGyroSampleRate getSampleRate() const {
|
||||
ob_error *error = nullptr;
|
||||
auto sampleRate = ob_gyro_stream_profile_get_sample_rate(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the intrinsic parameters of the stream.
|
||||
*
|
||||
* @return OBGyroIntrinsic Return the intrinsic parameters.
|
||||
*/
|
||||
OBGyroIntrinsic getIntrinsic() const {
|
||||
ob_error *error = nullptr;
|
||||
auto intrinsic = ob_gyro_stream_get_intrinsic(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return intrinsic;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
OBGyroFullScaleRange fullScaleRange() const {
|
||||
return getFullScaleRange();
|
||||
}
|
||||
|
||||
OBGyroSampleRate sampleRate() const {
|
||||
return getSampleRate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing a LiDAR stream profile.
|
||||
*/
|
||||
|
||||
class LiDARStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit LiDARStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~LiDARStreamProfile() noexcept override = default;
|
||||
|
||||
OBLiDARScanRate getScanRate() const {
|
||||
ob_error *error = nullptr;
|
||||
auto rate = ob_lidar_stream_profile_get_scan_rate(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return rate;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> bool StreamProfile::is() const {
|
||||
switch(this->getType()) {
|
||||
case OB_STREAM_VIDEO:
|
||||
case OB_STREAM_IR:
|
||||
case OB_STREAM_IR_LEFT:
|
||||
case OB_STREAM_IR_RIGHT:
|
||||
case OB_STREAM_COLOR:
|
||||
case OB_STREAM_COLOR_LEFT:
|
||||
case OB_STREAM_COLOR_RIGHT:
|
||||
case OB_STREAM_DEPTH:
|
||||
case OB_STREAM_RAW_PHASE:
|
||||
case OB_STREAM_CONFIDENCE:
|
||||
return typeid(T) == typeid(VideoStreamProfile);
|
||||
case OB_STREAM_ACCEL:
|
||||
return typeid(T) == typeid(AccelStreamProfile);
|
||||
case OB_STREAM_GYRO:
|
||||
return typeid(T) == typeid(GyroStreamProfile);
|
||||
case OB_STREAM_LIDAR:
|
||||
return typeid(T) == typeid(LiDARStreamProfile);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class StreamProfileFactory {
|
||||
public:
|
||||
static std::shared_ptr<StreamProfile> create(const ob_stream_profile_t *impl) {
|
||||
ob_error *error = nullptr;
|
||||
const auto type = ob_stream_profile_get_type(impl, &error);
|
||||
Error::handle(&error);
|
||||
switch(type) {
|
||||
case OB_STREAM_IR:
|
||||
case OB_STREAM_IR_LEFT:
|
||||
case OB_STREAM_IR_RIGHT:
|
||||
case OB_STREAM_DEPTH:
|
||||
case OB_STREAM_COLOR:
|
||||
case OB_STREAM_COLOR_LEFT:
|
||||
case OB_STREAM_COLOR_RIGHT:
|
||||
case OB_STREAM_VIDEO:
|
||||
case OB_STREAM_CONFIDENCE:
|
||||
return std::make_shared<VideoStreamProfile>(impl);
|
||||
case OB_STREAM_ACCEL:
|
||||
return std::make_shared<AccelStreamProfile>(impl);
|
||||
case OB_STREAM_GYRO:
|
||||
return std::make_shared<GyroStreamProfile>(impl);
|
||||
case OB_STREAM_LIDAR:
|
||||
return std::make_shared<LiDARStreamProfile>(impl);
|
||||
default: {
|
||||
ob_error *err = ob_create_error(OB_STATUS_ERROR, "Unsupported stream type.", "StreamProfileFactory::create", "", OB_EXCEPTION_TYPE_INVALID_VALUE);
|
||||
Error::handle(&err);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class StreamProfileList {
|
||||
protected:
|
||||
const ob_stream_profile_list_t *impl_;
|
||||
|
||||
public:
|
||||
explicit StreamProfileList(ob_stream_profile_list_t *impl) : impl_(impl) {}
|
||||
~StreamProfileList() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_stream_profile_list(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the number of StreamProfile objects.
|
||||
*
|
||||
* @return uint32_t Return the number of StreamProfile objects.
|
||||
*/
|
||||
uint32_t getCount() const {
|
||||
ob_error *error = nullptr;
|
||||
auto count = ob_stream_profile_list_get_count(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the StreamProfile object at the specified index.
|
||||
*
|
||||
* @param[in] index The index of the StreamProfile object to be retrieved. Must be in the range [0, count-1]. Throws an exception if the index is out of
|
||||
* range.
|
||||
*
|
||||
* @return std::shared_ptr<StreamProfile> Return the StreamProfile object.
|
||||
*/
|
||||
std::shared_ptr<StreamProfile> getProfile(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_profile(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return StreamProfileFactory::create(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding video stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list is
|
||||
* returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] width The width of the stream. Pass OB_WIDTH_ANY if no matching condition is required.
|
||||
* @param[in] height The height of the stream. Pass OB_HEIGHT_ANY if no matching condition is required.
|
||||
* @param[in] format The type of the stream. Pass OB_FORMAT_ANY if no matching condition is required.
|
||||
* @param[in] fps The frame rate of the stream. Pass OB_FPS_ANY if no matching condition is required.
|
||||
*
|
||||
* @return std::shared_ptr<VideoStreamProfile> Return the matching resolution.
|
||||
*/
|
||||
std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(int width = OB_WIDTH_ANY, int height = OB_HEIGHT_ANY, OBFormat format = OB_FORMAT_ANY,
|
||||
int fps = OB_FPS_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_video_stream_profile(impl_, width, height, format, fps, &error);
|
||||
Error::handle(&error);
|
||||
auto vsp = StreamProfileFactory::create(profile);
|
||||
return vsp->as<VideoStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding video stream profile according to the decimation configuration. If multiple profiles match, the first one in the list is
|
||||
* returned. Throws an exception when no matching profile is found.
|
||||
*
|
||||
* @param[in] decimationConfig Decimation configuration. The actual resolution is computed fromthe original resolution and scale factor.
|
||||
* @param[in] format Stream format. Pass OB_FORMAT_ANY if no matching condition is required.
|
||||
* @param[in] fps Frame rate. Pass OB_FPS_ANY if no matching condition is required.
|
||||
*
|
||||
* @return std::shared_ptr<VideoStreamProfile> Return the matched video stream profile.
|
||||
*/
|
||||
std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(OBHardwareDecimationConfig decimationConfig, OBFormat format = OB_FORMAT_ANY,
|
||||
int fps = OB_FPS_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_video_stream_profile_by_decimation_config(impl_, decimationConfig, format, fps, &error);
|
||||
Error::handle(&error);
|
||||
auto vsp = StreamProfileFactory::create(profile);
|
||||
return vsp->as<VideoStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding accelerometer stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list
|
||||
* is returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] fullScaleRange The full scale range. Pass 0 if no matching condition is required.
|
||||
* @param[in] sampleRate The sampling frequency. Pass 0 if no matching condition is required.
|
||||
*/
|
||||
std::shared_ptr<AccelStreamProfile> getAccelStreamProfile(OBAccelFullScaleRange fullScaleRange, OBAccelSampleRate sampleRate) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_accel_stream_profile(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
auto asp = StreamProfileFactory::create(profile);
|
||||
return asp->as<AccelStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding gyroscope stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list is
|
||||
* returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] fullScaleRange The full scale range. Pass 0 if no matching condition is required.
|
||||
* @param[in] sampleRate The sampling frequency. Pass 0 if no matching condition is required.
|
||||
*/
|
||||
std::shared_ptr<GyroStreamProfile> getGyroStreamProfile(OBGyroFullScaleRange fullScaleRange, OBGyroSampleRate sampleRate) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_gyro_stream_profile(impl_, fullScaleRange, sampleRate, &error);
|
||||
Error::handle(&error);
|
||||
auto gsp = StreamProfileFactory::create(profile);
|
||||
return gsp->as<GyroStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding LiDAR stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list is
|
||||
* returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] scanRate The scan rate of LiDAR. Pass OB_LIDAR_SCAN_ANY if no matching condition is required.
|
||||
* @param[in] format The type of the stream. Pass OB_FORMAT_ANY if no matching condition is required.
|
||||
*/
|
||||
std::shared_ptr<LiDARStreamProfile> getLiDARStreamProfile(OBLiDARScanRate scanRate, OBFormat format) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_lidar_stream_profile(impl_, scanRate, format, &error);
|
||||
Error::handle(&error);
|
||||
auto lsp = StreamProfileFactory::create(profile);
|
||||
return lsp->as<LiDARStreamProfile>();
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
uint32_t count() const {
|
||||
return getCount();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,234 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "libobsensor/h/ObTypes.h"
|
||||
#include "libobsensor/h/TypeHelper.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace ob {
|
||||
class TypeHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief Convert OBFormat to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBFormat type.
|
||||
*
|
||||
* @return OBFormat of "string" type.
|
||||
*/
|
||||
static std::string convertOBFormatTypeToString(const OBFormat &type) {
|
||||
return ob_format_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameType type.
|
||||
*
|
||||
* @return OBFrameType of "string" type.
|
||||
*/
|
||||
static std::string convertOBFrameTypeToString(const OBFrameType &type) {
|
||||
return ob_frame_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBStreamType type.
|
||||
*
|
||||
* @return OBStreamType of "string" type.
|
||||
*/
|
||||
static std::string convertOBStreamTypeToString(const OBStreamType &type) {
|
||||
return ob_stream_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBSensorType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBSensorType type.
|
||||
*
|
||||
* @return OBSensorType of "string" type.
|
||||
*/
|
||||
static std::string convertOBSensorTypeToString(const OBSensorType &type) {
|
||||
return ob_sensor_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBIMUSampleRate to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBIMUSampleRate type.
|
||||
*
|
||||
* @return OBIMUSampleRate of "string" type.
|
||||
*/
|
||||
static std::string convertOBIMUSampleRateTypeToString(const OBIMUSampleRate &type) {
|
||||
return ob_imu_rate_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBIMUSampleRate to its numeric frequency value in Hz.
|
||||
*
|
||||
* @param[in] type OBIMUSampleRate type.
|
||||
*
|
||||
* @return IMU sample rate value in Hz.
|
||||
*/
|
||||
static float convertOBIMUSampleRateTypeToValue(const OBIMUSampleRate &type) {
|
||||
return ob_imu_rate_type_to_value(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert a numeric IMU sample rate value in Hz to OBIMUSampleRate.
|
||||
*
|
||||
* @param[in] value IMU sample rate value in Hz.
|
||||
*
|
||||
* @return Matching OBIMUSampleRate.
|
||||
*/
|
||||
static OBIMUSampleRate convertOBIMUSampleRateValueToType(float value) {
|
||||
return ob_imu_rate_value_to_type(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBGyroFullScaleRange to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBGyroFullScaleRange type.
|
||||
*
|
||||
* @return OBGyroFullScaleRange of "string" type.
|
||||
*/
|
||||
static std::string convertOBGyroFullScaleRangeTypeToString(const OBGyroFullScaleRange &type) {
|
||||
return ob_gyro_range_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBAccelFullScaleRange to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBAccelFullScaleRange type.
|
||||
*
|
||||
* @return OBAccelFullScaleRange of "string" type.
|
||||
*/
|
||||
static std::string convertOBAccelFullScaleRangeTypeToString(const OBAccelFullScaleRange &type) {
|
||||
return ob_accel_range_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBLiDARScanRate to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBLiDARScanRate type.
|
||||
* @return OBLiDARScanRate of "string" type.
|
||||
*/
|
||||
static std::string convertOBLiDARScanRateTypeToString(const OBLiDARScanRate &type) {
|
||||
return ob_lidar_scan_rate_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameMetadataType to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBFrameMetadataType type.
|
||||
*
|
||||
* @return OBFrameMetadataType of "string" type.
|
||||
*/
|
||||
static std::string convertOBFrameMetadataTypeToString(const OBFrameMetadataType &type) {
|
||||
return ob_meta_data_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBSensorType to OBStreamType type and then return.
|
||||
*
|
||||
* @param[in] type OBSensorType type.
|
||||
*
|
||||
* @return OBStreamType type.
|
||||
*/
|
||||
static OBStreamType convertSensorTypeToStreamType(OBSensorType type) {
|
||||
return ob_sensor_type_to_stream_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to OBSensorType and then return.
|
||||
*
|
||||
* @param[in] type OBStreamType type.
|
||||
*
|
||||
* @return OBSensorType type.
|
||||
*/
|
||||
static OBSensorType convertStreamTypeToSensorType(OBStreamType type) {
|
||||
return ob_stream_type_to_sensor_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBStreamType to OBFrameType and then return.
|
||||
*
|
||||
* @param[in] type OBStreamType type.
|
||||
*
|
||||
* @return OBFrameType type.
|
||||
*/
|
||||
static OBFrameType convertStreamTypeToFrameType(OBStreamType type) {
|
||||
return ob_stream_type_to_frame_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to OBStreamType and then return.
|
||||
*
|
||||
* @param[in] type OBFrameType type.
|
||||
*
|
||||
* @return OBStreamType type.
|
||||
*/
|
||||
static OBStreamType convertFrameTypeToStreamType(OBFrameType type) {
|
||||
return ob_frame_type_to_stream_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameType to OBSensorType and then return.
|
||||
*
|
||||
* @param[in] type OBFrameType type.
|
||||
*
|
||||
* @return OBSensorType type.
|
||||
*/
|
||||
static OBSensorType convertFrameTypeToSensorType(OBFrameType type) {
|
||||
return ob_frame_type_to_sensor_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the given sensor type is a video sensor.
|
||||
* @brief Video sensors are sensors that produce video frames.
|
||||
* @brief The following sensor types are considered video sensors:
|
||||
* OB_SENSOR_COLOR,
|
||||
* OB_SENSOR_COLOR_LEFT,
|
||||
* OB_SENSOR_COLOR_RIGHT,
|
||||
* OB_SENSOR_DEPTH,
|
||||
* OB_SENSOR_IR,
|
||||
* OB_SENSOR_IR_LEFT,
|
||||
* OB_SENSOR_IR_RIGHT,
|
||||
* OB_SENSOR_CONFIDENCE,
|
||||
*
|
||||
* @param[in] type The sensor type
|
||||
*
|
||||
* @return true/false
|
||||
*/
|
||||
static bool isVideoSensorType(OBSensorType type) {
|
||||
return ob_is_video_sensor_type(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the given stream type is a video stream.
|
||||
* @brief Video streams are streams that contain video frames.
|
||||
* @brief The following stream types are considered video streams:
|
||||
* OB_STREAM_VIDEO,
|
||||
* OB_STREAM_DEPTH,
|
||||
* OB_STREAM_COLOR,
|
||||
* OB_STREAM_COLOR_LEFT,
|
||||
* OB_STREAM_COLOR_RIGHT,
|
||||
* OB_STREAM_IR,
|
||||
* OB_STREAM_IR_LEFT,
|
||||
* OB_STREAM_IR_RIGHT,
|
||||
* OB_STREAM_CONFIDENCE,
|
||||
*
|
||||
* @param[in] type The stream type to check.
|
||||
*
|
||||
* @return true if the given stream type is a video stream, false otherwise.
|
||||
*/
|
||||
static bool isVideoStreamType(OBStreamType type) {
|
||||
return ob_is_video_stream_type(type);
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
#include <libobsensor/h/ObTypes.h>
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Utils.hpp
|
||||
* @brief The SDK utils class
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "libobsensor/h/Utils.h"
|
||||
#include "Device.hpp"
|
||||
#include "Types.hpp"
|
||||
#include "Frame.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace ob {
|
||||
class Device;
|
||||
|
||||
class CoordinateTransformHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation3dto3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_3d(source_point3f, extrinsic, target_point3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
|
||||
*
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point3f Target 3d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation2dto3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
OBExtrinsic extrinsic, OBPoint3f *target_point3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_2d_to_3d(source_point2f, source_depth_pixel_value, source_intrinsic, extrinsic, target_point3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
|
||||
*
|
||||
* @param[in] source_point3f Source 3d point value
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation3dto2d(const OBPoint3f source_point3f, const OBCameraIntrinsic target_intrinsic, const OBCameraDistortion target_distortion,
|
||||
OBExtrinsic extrinsic, OBPoint2f *target_point2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_2d(source_point3f, target_intrinsic, target_distortion, extrinsic, target_point2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 2d pixel coordinate of the target camera
|
||||
*
|
||||
* @param[in] source_intrinsic Source intrinsic parameters
|
||||
* @param[in] source_distortion Source distortion parameters
|
||||
* @param[in] source_point2f Source 2d point value
|
||||
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
|
||||
* @param[in] target_intrinsic Target intrinsic parameters
|
||||
* @param[in] target_distortion Target distortion parameters
|
||||
* @param[in] extrinsic Transformation matrix from source to target
|
||||
* @param[out] target_point2f Target 2d point value
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation2dto2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic,
|
||||
const OBCameraDistortion target_distortion, OBExtrinsic extrinsic, OBPoint2f *target_point2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_2d_to_2d(source_point2f, source_depth_pixel_value, source_intrinsic, source_distortion, target_intrinsic,
|
||||
target_distortion, extrinsic, target_point2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
static bool calibration3dTo3d(const OBCalibrationParam calibrationParam, const OBPoint3f sourcePoint3f, const OBSensorType sourceSensorType,
|
||||
const OBSensorType targetSensorType, OBPoint3f *targetPoint3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_3d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool calibration2dTo3d(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
|
||||
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint3f *targetPoint3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result =
|
||||
ob_calibration_2d_to_3d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool calibration3dTo2d(const OBCalibrationParam calibrationParam, const OBPoint3f sourcePoint3f, const OBSensorType sourceSensorType,
|
||||
const OBSensorType targetSensorType, OBPoint2f *targetPoint2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_2d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool calibration2dTo2d(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
|
||||
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint2f *targetPoint2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result =
|
||||
ob_calibration_2d_to_2d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::shared_ptr<ob::Frame> transformationDepthFrameToColorCamera(std::shared_ptr<ob::Device> device, std::shared_ptr<ob::Frame> depthFrame,
|
||||
uint32_t targetColorCameraWidth, uint32_t targetColorCameraHeight) {
|
||||
ob_error *error = NULL;
|
||||
|
||||
// unsafe operation, need to cast const to non-const
|
||||
auto unConstImpl = const_cast<ob_frame *>(depthFrame->getImpl());
|
||||
|
||||
auto result = transformation_depth_frame_to_color_camera(device->getImpl(), unConstImpl, targetColorCameraWidth, targetColorCameraHeight, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<ob::Frame>(result);
|
||||
}
|
||||
|
||||
static bool transformationInitXYTables(const OBCalibrationParam calibrationParam, const OBSensorType sensorType, float *data, uint32_t *dataSize,
|
||||
OBXYTables *xyTables) {
|
||||
ob_error *error = NULL;
|
||||
bool result = transformation_init_xy_tables(calibrationParam, sensorType, data, dataSize, xyTables, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void transformationDepthToPointCloud(OBXYTables *xyTables, const void *depthImageData, void *pointCloudData) {
|
||||
ob_error *error = NULL;
|
||||
transformation_depth_to_pointcloud(xyTables, depthImageData, pointCloudData, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
static void transformationDepthToRGBDPointCloud(OBXYTables *xyTables, const void *depthImageData, const void *colorImageData, void *pointCloudData) {
|
||||
ob_error *error = NULL;
|
||||
transformation_depth_to_rgbd_pointcloud(xyTables, depthImageData, colorImageData, pointCloudData, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
};
|
||||
|
||||
class PointCloudHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief save point cloud to ply file.
|
||||
*
|
||||
* @param[in] fileName Point cloud save path
|
||||
* @param[in] frame Point cloud frame
|
||||
* @param[in] saveBinary Binary or textual,true: binary, false: textual
|
||||
* @param[in] useMesh Save mesh or not, true: save as mesh, false: not save as mesh
|
||||
* @param[in] meshThreshold Distance threshold for creating faces in point cloud,default value :50
|
||||
*
|
||||
* @return bool save point cloud result
|
||||
*/
|
||||
static bool savePointcloudToPly(const char *fileName, std::shared_ptr<ob::Frame> frame, bool saveBinary, bool useMesh, float meshThreshold) {
|
||||
ob_error *error = NULL;
|
||||
auto unConstImpl = const_cast<ob_frame *>(frame->getImpl());
|
||||
bool result = ob_save_pointcloud_to_ply(fileName, unConstImpl, saveBinary, useMesh, meshThreshold, &error);
|
||||
Error::handle(&error, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Save LiDAR point cloud to PLY file.
|
||||
*
|
||||
* @param[in] fileName Point cloud save path
|
||||
* @param[in] frame LiDAR point cloud frame
|
||||
* @param[in] saveBinary Binary or textual,true: binary, false: textual
|
||||
* @return bool save LiDAR point cloud result
|
||||
*/
|
||||
static bool saveLiDARPointcloudToPly(const char *fileName, std::shared_ptr<ob::LiDARPointsFrame> frame, bool saveBinary) {
|
||||
ob_error *error = NULL;
|
||||
auto unConstImpl = const_cast<ob_frame *>(frame->getImpl());
|
||||
bool result = ob_save_lidar_pointcloud_to_ply(fileName, unConstImpl, saveBinary, &error);
|
||||
Error::handle(&error, false);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file Version.hpp
|
||||
* @brief Provides functions to retrieve version information of the SDK.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "libobsensor/h/Version.h"
|
||||
|
||||
namespace ob {
|
||||
class Version {
|
||||
public:
|
||||
/**
|
||||
* @brief Get the full version number of the SDK.
|
||||
* @brief The full version number equals to: major * 10000 + minor * 100 + patch
|
||||
*
|
||||
* @return int The full version number of the SDK.
|
||||
*/
|
||||
static int getVersion() {
|
||||
return ob_get_version();
|
||||
}
|
||||
/**
|
||||
* @brief Get the major version number of the SDK.
|
||||
*
|
||||
* @return int The major version number of the SDK.
|
||||
*/
|
||||
static int getMajor() {
|
||||
return ob_get_major_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the minor version number of the SDK.
|
||||
*
|
||||
* @return int The minor version number of the SDK.
|
||||
*/
|
||||
static int getMinor() {
|
||||
return ob_get_minor_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the patch version number of the SDK.
|
||||
*
|
||||
* @return int The patch version number of the SDK.
|
||||
*/
|
||||
static int getPatch() {
|
||||
return ob_get_patch_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the stage version of the SDK.
|
||||
* @brief The stage version string is a vendor defined string for some special releases.
|
||||
*
|
||||
* @return char* The stage version string of the SDK.
|
||||
*/
|
||||
static const char *getStageVersion() {
|
||||
return ob_get_stage_version();
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file for configuration "Release".
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Import target "ob::OrbbecSDK" for configuration "Release"
|
||||
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.9.3"
|
||||
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
|
||||
)
|
||||
|
||||
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
|
||||
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.9.3" )
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
@@ -0,0 +1,104 @@
|
||||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 2.8.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
message(FATAL_ERROR "CMake >= 2.8.3 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 2.8.3...3.28)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS ob::OrbbecSDK)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target ob::OrbbecSDK
|
||||
add_library(ob::OrbbecSDK SHARED IMPORTED)
|
||||
|
||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
)
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/OrbbecSDKConfig-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28"
|
||||
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
||||
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
@@ -0,0 +1,65 @@
|
||||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "2.9.3")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("2.9.3" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "2.9.3")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
@@ -0,0 +1 @@
|
||||
libdepthengine.so.2.0
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
libOrbbecSDK.so.2
|
||||
@@ -0,0 +1 @@
|
||||
libOrbbecSDK.so.2.9.3
|
||||
Binary file not shown.
Reference in New Issue
Block a user