1

I have tried just about everything for getting the Kinect for Windows to actually produce an image. I have downloaded Daniel Shiffman's Openkinect library and I have installed it as instructed, yet I get the message that no kinect devices are installed. I took a look at the system profiler in Lion and I have the Camera and the Kinect Audio information available. Still, I have no success. I am running Processing with the RGBDepth example and I get a nullpointerexception every time I try to enable the depth image, RGB image, or IR image. I am thinking that because the program cannot 'see' the Kinect, the image returns null and the exception occurs. What can I do to have the Kinect 'seen' by my laptop?

Also, before you say to plug in the 12V DC adapter or switch the USB port, I have already done so.

Running on a Macbook Pro OSX Lion late 2011

1 Answers1

0

EDIT 2: Working code: This branch already contains a subset of the changes I was making, and actually runs. It's unstable, but at least you can get a depth and color image. https://github.com/zarvox/libfreenect/tree/k4w-wip

The instability is due to isochronous transfers in libusb on Darwin. The patch that comes with libfreenect just makes libusb less unstable.



Kinect for Windows isn't supported in the main tree. Have you tried this patch? https://github.com/renewagner/libfreenect/tree/k4w-wip

Edit: This repository is too old for the firmware version that I (we) have.

To detect the camera, you only need to change usb_libusb10.c in three places, where it checks desc.idProduct == PID_NUI_CAMERA. This must now be

(desc.idProduct == PID_NUI_CAMERA || desc.idProduct == PID_NUI_CAMERA_K4W);

And add:

#define PID_NUI_CAMERA_K4W 0x02bf

Also remember that the Kinect for Windows does not have a motor. You may need to modify source that assumes it exists.

This is still insufficient, however. The USB commands have also changed.

In cameras.c,

static int freenect_fetch_zero_plane_info(freenect_device *dev)
{
    freenect_context *ctx = dev->parent;

    char reply[0x200];
    uint16_t cmd[5] = {0}; // Offset is the only field in this command, and it's 0
    // Different reply based on hardware
    const int expected_reply_length = dev->kinect_for_windows ? 334 : 322;
    int res;
    res = send_cmd(dev, 0x04, cmd, 10, reply, expected_reply_length); //OPCODE_GET_FIXED_PARAMS = 4,
    if (res != expected_reply_length) {
        FN_ERROR("freenect_fetch_zero_plane_info: send_cmd read %d bytes (expected %d)\n", res, expected_reply_length);
        return -1;
    }

Note that I added a field to freenect_device to store if it's a Kinect for Windows.

It's still not streaming data, but this is as far as I've gotten.

Cat Zimmermann
  • 1,422
  • 2
  • 21
  • 38
  • I can't seem to get that patch working, is there any way you could walk me through it? – user1467562 Jun 26 '12 at 17:01
  • I just bought a Kinect for Windows and tried the patch; it doesn't work. First off, the USB Product ID is wrong in the code (I fixed that in my local copy). Once the camera is detected there's an error sending a USB command to it; I might have time this week to compare to my 360 Kinect and do some reverse engineering. – Cat Zimmermann Jun 26 '12 at 17:53
  • Ok, thanks, what do I have to change in the USB Product ID to make it work? – user1467562 Jun 26 '12 at 19:59
  • I'm not in front of my K4W, but: in examples/glview, take GDB and step into the code where it counts the number of devices (this should return 0 currently). You'll see references to NUI_CAMERA_ID or something like that (a #define). That needs to be changed to match the Product ID for the Kinect's USB Camera, that's found in your About this Mac->More Info (System Report)->USB->Microsoft HUB (I think) The correct value is 0x02bf, I believe. The original libfreenect code looks for 0x02AE (Kinect for 360). The k4w-wip tree has an ID that's still wrong. – Cat Zimmermann Jun 26 '12 at 23:42
  • Ok, thank you for all that you are doing, it is extremely appreciated. Again, thank you, Will I need to change that on everything in libfreenect? or is it only in the examples that I will need to change it? – user1467562 Jun 28 '12 at 16:47
  • I would if I could, it keeps telling me I cannot – user1467562 Jul 01 '12 at 05:06