some problems on aligning color Image and depth map RRS feed

  • 一般討論

  • For aligning ,I use the function "NuiImageGetColorPixelCoordinatesFromDepthPixel" to find the coordinate of RGB image corresponding to the coordinate of

    depth image .But I found there is some shift between RGB image and the depth map corresponding to RGB image(by the function



    here are the RGB image( and depth image(

    and code as follow

    for(int i=1 ; i<DEPTH_WIDTH ; i++)


    for(int j=1 ; j<DEPTH_HIGHT ; j++)


    USHORT realDepth = pBufferRun[j*DEPTH_WIDTH+i];    

    BYTE scale = 255 - (BYTE)(256*realDepth/0x0fff);

    int depthX = i ;

    int depthY = j ;

    long ix = 0, iy = 0;

    NuiImageGetColorPixelCoordinatesFromDepthPixel(NUI_IMAGE_RESOLUTION_640x480, NULL, 320-depthX ,depthY ,realDepth<<3 ,&ix ,&iy);

    if(ix>=0 && iy>=0 && ix<640 && iy<480 )


    buf[3*COLOR_WIDTH*iy+ix*3] = scale;

    buf[3*COLOR_WIDTH*iy+ix*3+1] = scale;

    buf[3*COLOR_WIDTH*iy+ix*3+2] = scale;



    and the initial type of depth is NUI_IMAGE_TYPE_DEPTH

    Is it wrong to use the function or it does some error because of Kinect??

    2011年11月13日 上午 08:04