some problems on aligning color Image and depth map RRS feed

  • Question

  • 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=0 ; i<DEPTH_WIDTH ; i++)


     for(int j=0 ; 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??

    • Edited by 夏飄雪 Sunday, November 13, 2011 8:08 AM
    Sunday, November 13, 2011 8:07 AM

All replies

  • Hello!

    I think the phenomenon you have found is right. I remember that I have see somebody did a experiment to align the color map and the depth map bidirectionally. His result showed that there did exist a shift between them(maybe shift to left and a bit upper). So this is just a truth and maybe Microsoft will supply functions to map between both of them bidirectionally.

    I wonder whether you have understood my meaning clearly, you can send me an email for further communication:


    Sunday, December 18, 2011 2:33 PM
  • Thank U, Stanley.  I have solve the problem. it really  exist a shift between them. I use the function " NuiImageGetColorPixelCoordinatesFromDepthPixel"

    in SDK and relation of the disparity and depth.  Although it is still some error there. But it does improved. If U want to know it much more,

    please connect me .

    Thursday, December 22, 2011 7:03 AM