![]() |
OrbbecSDK2 2.0.2
OrbbecSDK2: New generation Software-Development-Kit for Orbbec 3D-Sensor devices
|
#include "ob2types.h"
uint32_t ob2_device_get_supported_camera_count | ( | ob2_device_t | device_handle, |
ob2_status_t * | status | ||
) |
获取设备支持的相机个数
一个设备除了拥有一个 Depth 相机外,还可能会包含 Color、IR 相机,视具体型号而定。
[in] | device_handle | 设备句柄 |
[out] | status | 返回函数调用状态 |
ob2_camera_type_t ob2_device_get_supported_camera_type | ( | ob2_device_t | device_handle, |
uint32_t | index, | ||
ob2_status_t * | status | ||
) |
获取设备内指定索引号绑定的相机类型
[in] | device_handle | 设备句柄 |
[in] | index | 相机索引号 |
[out] | status | 返回函数调用状态 |
uint32_t ob2_device_get_camera_stream_profile_count | ( | ob2_device_t | device_handle, |
ob2_camera_type_t | camera_type, | ||
ob2_status_t * | status | ||
) |
获取指定相机类型支持的数据流配置个数
[in] | device_handle | 设备句柄 |
[in] | camera_type | 相机类型 |
[out] | status | 返回函数调用状态 |
ob2_camera_stream_profile_t ob2_device_get_camera_stream_profile | ( | ob2_device_t | device_handle, |
ob2_camera_type_t | camera_type, | ||
uint32_t | index, | ||
ob2_status_t * | status | ||
) |
通过索引号获取指定相机类型的数据流配置
[in] | device_handle | 设备句柄 |
[in] | camera_type | 相机类型 |
[in] | index | 索引号 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::device::get_camera_stream_profile_list() , 以及 ob2::device::get_default_camera_stream_profile().
uint32_t ob2_device_get_alignable_camera_stream_profile_count | ( | ob2_device_t | device_handle, |
ob2_images_align_mode_t | image_align_mode, | ||
ob2_camera_stream_profile_t | target_camera_stream_profile, | ||
ob2_status_t * | status | ||
) |
获取支持对齐的相机数据流配置个数
在 cameras_config 中配置图像对齐模式时,可以先通过当前接口查询配置的不同相机数据流是否支持该对齐模式。
[in] | device_handle | 设备句柄 |
[in] | image_align_mode | 图像对齐模式 |
[in] | target_camera_stream_profile | 对齐的目标相机数据流配置(如:对齐模式为 OB2_IMAGES_ALIGN_MODE_D2C_HARDWARE ,则目标相机是 color 相机) |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::device::get_alignable_camera_stream_profile_list().
ob2_camera_stream_profile_t ob2_device_get_alignable_camera_stream_profile | ( | ob2_device_t | device_handle, |
ob2_images_align_mode_t | align_mode, | ||
ob2_camera_stream_profile_t | target_camera_stream_profile, | ||
uint32_t | index, | ||
ob2_status_t * | status | ||
) |
通过索引号获取支持对齐的相机数据流配置
在 cameras_config 中配置图像对齐模式时,可以先通过当前接口查询配置的不同相机数据流是否支持该对齐模式。
[in] | device_handle | 设备句柄 |
[in] | align_mode | 图像对齐模式 |
[in] | target_camera_stream_profile | 对齐的目标相机数据流配置(如:对齐模式为 OB2_IMAGES_ALIGN_MODE_D2C_HARDWARE ,则目标相机是 color 相机) |
[in] | index | 相机数据流配置索引号 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::device::get_alignable_camera_stream_profile_list().
ob2_cameras_config_t ob2_device_create_cameras_config | ( | ob2_device_t | device_handle, |
ob2_status_t * | status | ||
) |
创建设备的相机配置
相机配置用于配置设备内各相机的工作方式以及 SDK 内部对相机图像的处理方式(具体支持的功能请查看 cameras_config 各接口说明)
相机配置创建后会为所有支持的相机配置一个默认的流配置,但是所有相机都是默认未使能的。
[in] | device_handle | 设备句柄, 传入句柄进行相机配置已实现在调用各配置接口时完成配置参数的合法性检查 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::device::create_cameras_config().
void ob2_cameras_config_release | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_status_t * | status | ||
) |
释放相机配置句柄
[in] | cameras_config_handle | 需要被释放的相机配置句柄 |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_camera_stream_profile | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_camera_type_t | camera_type, | ||
const ob2_camera_stream_profile_t * | stream_profile, | ||
ob2_status_t * | status | ||
) |
设置相机数据流配置
[in] | cameras_config_handle | 相机配置句柄 |
[in] | camera_type | 需要配置的相机类型 |
[in] | stream_profile | 需要配置的相机数据流配置 |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_enable_camera_stream | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_camera_type_t | camera_type, | ||
ob2_status_t * | status | ||
) |
使能相机
启动相机时会将相机配置内已使能的相机依据设置的数据流配置开启数据流
[in] | cameras_config_handle | 相机配置句柄 |
[in] | camera_type | 需要使能的相机类型 |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_and_enable_camera_stream | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_camera_type_t | camera_type, | ||
uint32_t | width_pixels, | ||
uint32_t | height_pixels, | ||
uint32_t | frame_rate, | ||
ob2_image_format_t | format, | ||
ob2_status_t * | status | ||
) |
配置相机数据流并使能相机
启动相机时会将相机配置内已使能的相机依据设置的数据流配置开启数据流
相机数据流配置参数支持模糊匹配,即在进行匹配支持的相机数据流配置时,模糊匹配项不进行匹配,而是选用默认配置。
[in] | cameras_config_handle | 相机配置句柄 |
[in] | camera_type | 需要使能的相机类型 |
[in] | width_pixels | 配置的数据流图像宽度,单位:像素;可传入 OB2_ANY_WIDTH 进行模糊匹配。 |
[in] | height_pixels | 配置的数据流图高度,单位:像素;可传入 OB2_ANY_HEIGHT 进行模糊匹配。 |
[in] | frame_rate | 配置的数据流图像帧率,单位:fps;可传入 OB2_ANY_FRAME_RATE 进行模糊匹配。 |
[in] | format | 配置的数据流图像格式; 可传入 OB2_ANY_FRAME_RATE 进行模糊匹配。 |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_disable_camera_stream | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_camera_type_t | camera_type, | ||
ob2_status_t * | status | ||
) |
关闭(去除使能)相机数据流
cameras_config_handle | 相机配置句柄 | |
[in] | camera_type | 需要关闭的相机类型 |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_images_sync_mode | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_images_sync_mode_t | images_sync_mode, | ||
ob2_status_t * | status | ||
) |
设备内多相机图像同步模式配置
SDK 内部会根据图像同步模式等待各相机的输出图像,然后将各相机的图像各取一帧用于生成 capture
[in] | cameras_config_handle | 相机配置句柄 |
[in] | images_sync_mode | 图像同步模式,默认模式为:::OB2_IMAGES_SYNC_MODE_WAIT_LATER_COMER |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_produce_capture_policy | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_produce_capture_policy_t | policy, | ||
ob2_status_t * | status | ||
) |
capture 生成策略配置
capture 生成时,会根据图像同步模式配置的方式,同步所有已启用相机的图像。但是由于不同相机帧率配置不一致、数据传输错误丢帧等原因,并不能保证 所有情况下都能够同步成功。capture 生成策略用于控制在已经无法同步所有已启用相机图像帧的情况下,如何处理当前相机图像(丢弃图像或者生成不完整 capture)。
[in] | cameras_config_handle | 相机配置句柄 |
[in] | policy | capture 生成策略, 默认策略为:::OB2_PRODUCE_CAPTURE_SYNC_IMAGES_ONLY |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_images_align_mode | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_images_align_mode_t | mode, | ||
ob2_status_t * | status | ||
) |
图像对齐模式配置
[in] | cameras_config_handle | 相机配置句柄 |
[in] | mode | 对齐模式,默认模式为:::OB2_IMAGES_ALIGN_MODE_DISABLE |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_cameras_sync_mode | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_cameras_sync_mode_t | sync_mode, | ||
ob2_status_t * | status | ||
) |
(单机内)多相机同步(同步曝光)模式配置
[in] | cameras_config_handle | 相机配置句柄 |
sync_mode | 同步模式,默认模式:::OB2_CAMERA_SYNC_MODE_CLOSE。 | |
status | 返回函数调用状态 |
void ob2_cameras_config_set_cameras_sync_delay_usec | ( | ob2_cameras_config_t | cameras_config_handle, |
uint32_t | cameras_sync_delay_usec, | ||
ob2_status_t * | status | ||
) |
(单机内)多相机同步延时配置,用于控制从相机在主相机图像采集后延时多长时间开始图像采集
当多相机同步模式配置为 OB2_CAMERA_SYNC_MODE_COLOR_EXPOSURE_FIRST 时表示 Depth/IR 相机相对 Color 相机的延时
当多相机同步模式配置为 OB2_CAMERA_SYNC_MODE_DEPTH_EXPOSURE_FIRST 时表示 Color 相机相对 Depth/IR 相机的延时
当多相机同步模式配置为 OB2_CAMERA_SYNC_MODE_CLOSE 时该延时配置无任何效果
[in] | cameras_config_handle | 相机配置句柄 |
[in] | cameras_sync_delay_usec | 相机同步延时,单位为微秒, 默认值为 0 |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_wired_sync_mode | ( | ob2_cameras_config_t | cameras_config_handle, |
ob2_wired_sync_mode_t | wired_sync_mode, | ||
ob2_status_t * | status | ||
) |
外部同步模式配置(通常是通过同步信号线输入 / 输出同步信号完成同步,所以命名为 wired_sync_mode)
该功能实际上是配置设备相机的触发信号来源,及触发信号中继输出。主要用于实现多机同步功能。
[in] | cameras_config_handle | 相机配置句柄 |
[in] | wired_sync_mode | 外部同步模式,默认为 OB2_WIRED_SYNC_MODE_STANDALONE |
[out] | status | 返回函数调用状态 |
void ob2_cameras_config_set_secondary_delay_off_primary_usec | ( | ob2_cameras_config_t | cameras_config_handle, |
uint32_t | secondary_delay_usec, | ||
ob2_status_t * | status | ||
) |
从设备延时配置
配置为 OB2_WIRED_SYNC_MODE_SECONDARY 模式的设备,在接收到触发信号后,延时一段时间后再执行图像采集。
[in] | cameras_config_handle | 相机配置句柄 |
[in] | secondary_delay_usec | 从设备延时,单位:微秒,默认值为 0。 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::cameras_config::set_secondary_delay_off_primary_usec().
ob2_cameras_calibration_t ob2_device_get_cameras_calibration | ( | ob2_device_t | device_handle, |
const ob2_cameras_config_t | cameras_config_handle, | ||
ob2_status_t * | status | ||
) |
获取当前配置下的相机标定参数
[in] | device_handle | 设备句柄 |
[in] | cameras_config_handle | 相机配置句柄 |
[out] | status | 返回函数调用状态 |
void ob2_device_start_cameras | ( | ob2_device_t | device_handle, |
const ob2_cameras_config_t | cameras_config_handle, | ||
ob2_status_t * | status | ||
) |
启动设备内相机工作(开流)
会根据 cameras_config_handle 开启已使能的相机数据流,同时也会根据配置内容完成设备、SDK 内部相关工作模块的配置。
开启数据流后,SDK 内部会将各相机输出的图像生成 capture,并将 capture 缓存在内部队列,用户需要通过 ob2_device_get_capture 接口获取 capture, 进而通过 capture 获取各相机图像数据。
[in] | device_handle | 设备句柄 |
[in] | cameras_config_handle | 相机配置句柄,调用完本接口后可立即停释放相机配置句柄。可传入 OB2_DEFAULT_CAMERAS_CONFIG, 这样 SDK 将通过各相机的默认流配置启动所有相机。 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::device::start_cameras().
void ob2_device_start_cameras_with_callback | ( | ob2_device_t | device_handle, |
const ob2_cameras_config_t | cameras_config_handle, | ||
ob2_capture_cb_t | cb, | ||
void * | user_data, | ||
ob2_status_t * | status | ||
) |
通过回调返回 capture 的方式启动设备内相机工作(开流)
会根据 cameras_config_handle 开启已使能的相机数据流,同时也会根据配置内容完成设备、SDK 内部相关工作模块的配置
开启数据流后,SDK 内部会将各相机输出的图像生成 capture,并通过回调函数 cb 返回 capture
[in] | device_handle | 设备句柄 |
[in] | cameras_config_handle | 相机配置,调用完本接口后可立即停释放相机配置句柄。可传入 OB2_DEFAULT_CAMERAS_CONFIG, 这样 SDK 将通过各相机的默认流配置启动所有相机 |
[in] | cb | capture 回调函数 |
[in] | user_data | 用户自定义数据,会通过 cb 原样返回,用户可通过 user_data 传递上下文数据 |
[out] | status | 返回函数调用状态 |
void ob2_device_update_cameras_config | ( | ob2_device_t | device_handle, |
const ob2_cameras_config_t | cameras_config_handle, | ||
ob2_status_t * | status | ||
) |
更新设备相机配置
可实现设备相机工作过程中的配置更新,比如在不停止相机工作的情况下打开或关闭某一类型相机的数据流
[in] | device_handle | 设备句柄 |
[in] | cameras_config_handle | 用于更新的相机配置 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::device::update_cameras_config().
void ob2_device_stop_cameras | ( | ob2_device_t | device_handle, |
ob2_status_t * | status | ||
) |
ob2_capture_t ob2_device_get_capture | ( | ob2_device_t | device_handle, |
int32_t | timeout_msec, | ||
ob2_status_t * | status | ||
) |
获取 capture
配合 ob2_device_start_cameras 接口使用,在启动设备内相机工作后,通过本接口获取接收到图像后生成的 capture。
调用本接口后,如果 SDK 内部未有 capture 缓存在队列中,会进行阻塞式等待,直到成功获取到 capture 或者等待超过了 @timeout_msec 设定的时间。
[in] | device_handle | 设备句柄 |
[in] | timeout_msec | 等待超时时间,可以设置为 OB2_WAIT_INFINITE 表示不限时等待。 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::device::get_capture().
ob2_capture_t ob2_capture_create | ( | ob2_status_t * | status | ) |
创建 capture
创建 capture 后,可用于用户的自定义图像的暂存(通过 ob2_capture_set_image 实现图像暂存)
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::capture().
void ob2_capture_reference | ( | ob2_capture_t | capture_handle, |
ob2_status_t * | status | ||
) |
增加 capture 引用计数
通过 SDK 的任何接口获取或创建的 capture 的引用计数都是 1,通过调用本接口可使引用计数加 1。然后每次调用 ob2_capture_release 会使引用计数减 1, 当引用计数减为 0 时,才会真正释放 capture 句柄所绑定的内存。
[in] | capture_handle | capture 句柄 |
[out] | status | 返回函数调用状态 |
void ob2_capture_release | ( | ob2_capture_t | capture_handle, |
ob2_status_t * | status | ||
) |
释放 capture
实际上每次调用 ob2_capture_release 会将 capture 的引用计数减 1,当引用计数减为 0 时,才会真正释放 capture 句柄所绑定的内存。
[in] | capture_handle | capture 句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::~capture().
ob2_image_t ob2_capture_get_image | ( | ob2_capture_t | capture_handle, |
ob2_camera_type_t | camera_type, | ||
ob2_status_t * | status | ||
) |
获取指定相机的图像
[in] | capture_handle | capture 句柄 |
[in] | camera_type | 相机类型 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::get_image().
ob2_image_t ob2_capture_get_color_image | ( | ob2_capture_t | capture_handle, |
ob2_status_t * | status | ||
) |
获取 Color 相机图像
[in] | capture_handle | capture 句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::get_color_image().
ob2_image_t ob2_capture_get_depth_image | ( | ob2_capture_t | capture_handle, |
ob2_status_t * | status | ||
) |
获取 Depth 相机图像
[in] | capture_handle | capture 句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::get_depth_image().
ob2_image_t ob2_capture_get_ir_image | ( | ob2_capture_t | capture_handle, |
ob2_status_t * | status | ||
) |
获取红外相机图像
[in] | capture_handle | capture 句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::get_ir_image().
void ob2_capture_set_image | ( | ob2_capture_t | capture_handle, |
ob2_camera_type_t | camera_type, | ||
ob2_image_t | image_handle, | ||
ob2_status_t * | status | ||
) |
设置指定相机的图像
会将图像拷贝(浅拷贝)保存一份到 capture 内,如果 capture 已包含指定相机的图像,则会先将原图像释放。
[in] | capture_handle | capture 句柄 |
[in] | camera_type | 相机类型 |
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::set_image().
void ob2_capture_set_color_image | ( | ob2_capture_t | capture_handle, |
ob2_image_t | image_handle, | ||
ob2_status_t * | status | ||
) |
设置 Color 相机的图像
会将图像拷贝(浅拷贝)保存一份到 capture 内,如果 capture 已包含 Color 相机的图像,则会先将原图像释放。
[in] | capture_handle | capture 句柄 |
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::set_color_image().
void ob2_capture_set_depth_image | ( | ob2_capture_t | capture_handle, |
ob2_image_t | image_handle, | ||
ob2_status_t * | status | ||
) |
设置 Depth 相机的图像
会将图像拷贝(浅拷贝)保存一份到 capture 内,如果 capture 已包含 Depth 相机的图像,则会先将原图像释放。
[in] | capture_handle | capture 句柄 |
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::set_depth_image().
void ob2_capture_set_ir_image | ( | ob2_capture_t | capture_handle, |
ob2_image_t | image_handle, | ||
ob2_status_t * | status | ||
) |
设置红外相机的图像
会将图像拷贝(浅拷贝)保存一份到 capture 内,如果 capture 已包含红外相机的图像,则会先将原图像释放。
[in] | capture_handle | capture 句柄 |
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::capture::set_ir_image().
ob2_image_t ob2_image_create | ( | ob2_camera_type_t | source_camera_type, |
ob2_image_format_t | format, | ||
uint32_t | width_pixels, | ||
uint32_t | height_pixels, | ||
uint32_t | stride_bytes, | ||
ob2_status_t * | status | ||
) |
创建图像
SDK 内部会根据图像格式、宽、高、行跨都等信息在内部申请一块合适大小内存的内存
[in] | source_camera_type | 图像原相机类型(用于图像信息追踪,可以填 OB2_CAMERA_UNKNOWN ) |
[in] | format | 图像格式 |
[in] | width_pixels | 图像宽,单位:像素 |
[in] | height_pixels | 图像高,单位:像素 |
[in] | stride_bytes | 图像行跨度,单位:字节 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::image().
ob2_image_t ob2_image_create_from_buffer | ( | ob2_camera_type_t | source_camera_type, |
ob2_image_format_t | format, | ||
uint32_t | width_pixels, | ||
uint32_t | height_pixels, | ||
uint32_t | stride_bytes, | ||
uint8_t * | buffer, | ||
uint32_t | buffer_size, | ||
ob2_buffer_release_cb_t | buffer_release_cb, | ||
void * | user_data, | ||
ob2_status_t * | status | ||
) |
从指定 buffer 创建图像
创建好的图像的 buffer 即为传入的 buffer,buffer 内存的申请和释放都需要用户代码完成
[in] | source_camera_type | 图像原相机类型(用于图像信息追踪,可以填 OB2_CAMERA_UNKNOWN ) |
[in] | format | 图像格式 |
[in] | width_pixels | 图像宽,单位:像素 |
[in] | height_pixels | 图像高,单位:像素 |
[in] | stride_bytes | 图像行跨度,单位:字节 |
[in] | buffer | buffer 地址指针 |
[in] | buffer_size | buffer 内存大小,单位:字节 |
[in] | buffer_release_cb | buffer 释放回调函数,会在 image 释放时调用,用户需要确保该回调函数能够准确释放内存 |
[in] | user_data | 用户自定义数据,会在调用 buffer_release_cb 时返回,用户可以传入上下文数据 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::image().
void ob2_image_reference | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
增加图像引用计数
通过 SDK 的任何接口获取或创建的图像的引用计数都是 1,通过调用本接口可使引用计数加 1。然后每次调用 ob2_image_release 会使引用计数减 1, 当引用计数减为 0 时,才会真正释放 image 句柄所绑定的内存。
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
void ob2_image_release | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
释放图像
实际上每次调用 ob2_image_release 会将图像的引用计数减 1,当引用计数减为 0 时,才会真正释放 image 句柄所绑定的内存。
[in] | image_handle | capture 句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::~image().
uint8_t * ob2_image_get_buffer | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像 buffer
图像 buffer 内放的即是图像的数据,用户可以通过返回的 buffer 指针直接读取或修改图像数据。
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_buffer().
uint32_t ob2_image_get_size | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像数据大小
通常图像的数据大小会与 buffer 内存大小一致,但是对于压缩或者编码格式图像,图像数据数据大小会小于 buffer 大小。 不过 buffer 大小对用户是没有啥实际意义的,所以可以不用理会
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_size().
ob2_image_format_t ob2_image_get_format | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像格式
图像格式代表着图像像素的排列方式、压缩、编码等特性。用户需要根据图像格式决定如何使用图像数据
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_format().
uint32_t ob2_image_get_width_pixels | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像宽度
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_width_pixels().
uint32_t ob2_image_get_height_pixels | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像高度
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_height_pixels().
uint32_t ob2_image_get_stride_bytes | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像行跨度
用户可以通过行跨度大小,对 buffer 地址指针进行偏移,从而快速获取图像指定坐标下的像素数据
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_stride_bytes().
uint64_t ob2_image_get_device_timestamp_usec | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取设备时间戳
设备实间戳是指图像在设备端打上的时间戳,这个时间戳最接近图像生成时的时间
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
uint64_t ob2_image_get_system_timestamp_usec | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取系统时间戳
系统时间戳是指 Host 端 SDK 接收到图像数据时打的时间戳(Host 的 localtime,是从 1970-01-01T00:00:00Z. 开始的计时)
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
ob2_camera_type_t ob2_image_get_source_camera_type | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像源相机类型
通过 SDK 获取得到的图像都会填写源相机类型,代表了图像数据来源
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_source_camera_type().
uint8_t ob2_image_get_available_bits_for_each_pixel | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取图像像素有效位数
对于 Depth 和 IR 图像,通常其图像像素只有低位有效,高位固定为零。(比如某相机深度是 Y16 格式的图像,其像素位位数为 16, 但是只有低 14 位有效,高两位为零,此时调用本接口将返回 14)
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
float ob2_depth_image_get_value_scale | ( | ob2_image_t | image_handle, |
ob2_status_t * | status | ||
) |
获取深度图像数值缩放系数
深度图像像素值意义为目标物体到相机的距离,单位为 mm。但是,由于相机特性、算法处理等原因,实际图像的数值可能会被缩放。 本接口返回用于将图像数据恢复为以毫米为单位的数值时所需要缩放的系数, 比如,scale=0.1 时, 某坐标下像素值为 pixel_value=10000, 则表示深度距离 value = pixel_Value*scale = 10000*0.1=1000mm。
[in] | image_handle | 图像句柄 |
[out] | status | 返回函数调用状态 |
被这些函数引用 ob2::image::get_value_scale().