mirror of
https://github.com/storytold/LiveScan3D.git
synced 2026-11-24 11:10:48 +01:00
Added support for multiple Azure Kinects on same machine
This commit is contained in:
1 parent
f49bcaf5d9
commit
e2a03f9c8a
6 files changed
+27
-20
No files matched your search
@@ -18,19 +18,19 @@ AzureKinectCapture::~AzureKinectCapture()
|
||||
}
|
||||
|
||||
bool AzureKinectCapture::Initialize()
|
||||
{
|
||||
return Initialize(K4A_DEVICE_DEFAULT);
|
||||
}
|
||||
|
||||
bool AzureKinectCapture::Initialize(int deviceIdx)
|
||||
{
|
||||
uint32_t count = k4a_device_get_installed_count();
|
||||
int deviceIdx = 0;
|
||||
|
||||
kinectSensor = NULL;
|
||||
if (K4A_FAILED(k4a_device_open(deviceIdx, &kinectSensor)))
|
||||
while (K4A_FAILED(k4a_device_open(deviceIdx, &kinectSensor)))
|
||||
{
|
||||
bInitialized = false;
|
||||
return bInitialized;
|
||||
deviceIdx++;
|
||||
if (deviceIdx >= count)
|
||||
{
|
||||
bInitialized = false;
|
||||
return bInitialized;
|
||||
}
|
||||
}
|
||||
|
||||
k4a_device_configuration_t config = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
|
||||
@@ -64,6 +64,11 @@ bool AzureKinectCapture::Initialize(int deviceIdx)
|
||||
}
|
||||
} while (!bTemp);
|
||||
|
||||
size_t serialNoSize;
|
||||
k4a_device_get_serialnum(kinectSensor, NULL, &serialNoSize);
|
||||
serialNumber = std::string(serialNoSize, '\0');
|
||||
k4a_device_get_serialnum(kinectSensor, (char*)serialNumber.c_str(), &serialNoSize);
|
||||
|
||||
|
||||
return bInitialized;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user