Error : Intellisense showing identifier is undefined in NuiSensor.h function RRS feed

  • Question

  • I am trying to get color and depth images from Kinect. I am using Kinect SDK v-1.8.0 and MS Visual Studio 2010 and code is in C++.

    At first, to align the depth and color images I was using NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution to map depth into color. But since it works at pixel level, it turned out to be pretty slow and I was losing frames. Capture got down to almost  5-fps, without mapping it was working at 30-fps.

    So instead, now I am using NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution which works at frame level.
    But IntelliSense is showing "Error: identifier is undefined". I have included both <NuiApi.h> and <NuiSensor.h> in my code (though only including <NuiApi.h> would have sufficed since it calls the other one already).

    Here is the piece of code:

    long *pMappedBits = new long[COLOR_WIDTH * COLOR_HIGHT * 2];
    if (depthLockedRect.Pitch != 0 && colorLockedRect.Pitch != 0)
        USHORT * depthBuff = (USHORT*) depthLockedRect.pBits;
        NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution(NUI_IMAGE_RESOLUTION_640x480, NUI_IMAGE_RESOLUTION_640x480, DEPTH_WIDTH * DEPTH_HIGHT, depthBuff, COLOR_WIDTH * COLOR_HIGHT * 2, pMappedBits);
           // code to align depth and color images

    I have also included <windows.h> as I came across a forum, but then also it's not working. I even checked my <NuiSensor.h> file, it contains the function alright

    #define INuiSensor_NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution(This,eColorResolution,eDepthResolution,cDepthValues,pDepthValues,cColorCoordinates,pColorCoordinates)	\
        ( (This)->lpVtbl -> NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution(This,eColorResolution,eDepthResolution,cDepthValues,pDepthValues,cColorCoordinates,pColorCoordinates) ) 

    Any help regarding the probable cause would be highly appreciated. What's confusing me more is that NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution was working absolutely fine and I was getting the correctly mapped image, but this one isn't.

    Thanks in advance.

    Friday, December 19, 2014 7:53 PM

All replies

  • You need to also include the Shlobj.h after Windows.h and before Kinect.h. Do the samples work? Have a look at the code provided. Also, those api's are deprecated in favor of the coordinate mapper api's. Have a look at the coordinateMappingBasics sample for its use.

    Carmine Sirignano - MSFT

    Monday, January 5, 2015 11:48 PM