microsoft / Azure-Kinect-Sensor-SDK

A cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.
https://Azure.com/Kinect
MIT License
1.47k stars 613 forks source link

Window:find_libusb_device(). libusb device(s) are all unavalable. Is the device being used by another application? #1974

Open Risekj opened 3 months ago

Risekj commented 3 months ago

When I use the following code to open the camera, the device cannot be found, failure in k4a _device_open(), the error is as follows: [2024-03-07 23:22:49.370] [critical] [t=8668] E:\vcpkg\buildtrees\azure-kinect-sensor-sdk\src\v1.4.1-4fd9fcd081.clean\src\usbcommand\usbcommand.c (366): find_libusb_device(). libusb device(s) are all unavalable. Is the device being used by another application? [2024-03-07 23:22:49.373] [error] [t=8668] E:\vcpkg\buildtrees\azure-kinect-sensor-sdk\src\v1.4.1-4fd9fcd081.clean\src\depth_mcu\depth_mcu.c (68): usb_cmd_create(USB_DEVICE_DEPTH_PROCESSOR, device_index, NULL, &depthmcu->usb_cmd) returned failure in depthmcu_create() [2024-03-07 23:22:49.373] [error] [t=8668] E:\vcpkg\buildtrees\azure-kinect-sensor-sdk\src\v1.4.1-4fd9fcd081.clean\src\sdk\k4a.c (133): depthmcu_create(index, &device->depthmcu) returned failure in k4a_device_open()

Code: k4a::device device = k4a::device::open(0); // 打开第一个连接的相机
k4a::calibration calibration = device.get_calibration(K4A_DEPTH_MODE_NFOV_2X2BINNED, K4A_COLOR_RESOLUTION_1080P);

try {
    k4a::device device = k4a::device::open(0);
}
catch (const std::exception& e) {
    std::cerr << "failed to open device: " << e.what() << std::endl;
    return -1; // 或其他错误处理
}

However, I can connect to the camera and view the data normally with the built-in Azure Kinect Viewer v1.4.1.

And my other program, as shown below, is able to connect the camera and configure it normally void kinectviewer::connect_camera() { ui->output_result->setFont(QFont("Arial Unicode MS"));

// 打开 Azure Kinect 设备
if (K4A_FAILED(k4a_device_open(K4A_DEVICE_DEFAULT, &device)))
{
    ui->output_result->append(QString::fromUtf8("无法打开 Azure Kinect 设备!"));
    return;
}
ui->output_result->append(QString::fromUtf8("连接相机成功"));

// 配置设备启用深度和红外流
this->config = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
this->config.camera_fps = K4A_FRAMES_PER_SECOND_15;
this->config.depth_mode = K4A_DEPTH_MODE_NFOV_2X2BINNED;
this->config.color_format = K4A_IMAGE_FORMAT_COLOR_BGRA32;
this->config.color_resolution = K4A_COLOR_RESOLUTION_1080P;

}