Initialization
Initialization
首先获取当前连接的 Azure Kinect 设备数量,然后通过索引打开相应的设备。打开设备需要提供一个类型为 k4a_device_t 的 device handle。
// get connected device count
uint32_t count = k4a_device_get_installed_count();
if (count == 0)
{
printf("No k4a devices attached!\n");
return 1;
}
k4a_device_t device = NULL;
for (uint32_t deviceIndex = 0; deviceIndex < count; deviceIndex++)
{
// open the device
if (K4A_RESULT_SUCCEEDED != k4a_device_open(deviceIndex, &device))
{
printf("%d: Failed to open device\n", deviceIndex);
continue;
}
...
}如果只有一个设备连接,也可以通过预定义的 DEFAULT 标识符来连接:
不同连接时机下同一台设备的索引可能不同,如果希望连接到固定的某一台设备,可以查询设备的序列号。
任何设备使用完毕后,都需要关闭。
Reference
[1] https://docs.microsoft.com/en-us/azure/kinect-dk/find-then-open-device
Last updated
Was this helpful?