Wierd image with GetColorPixelCoordinatesFromDepthPixel RRS feed

  • Question

  • Hi,

    I'm also trying to get the depth image aligned with its color image and I'm having a few problems doing it!! First of all, I tryed mapping a 640x480 depth image to a 640x480 but I realised that the transform is only meant for a 320x240 depth images... This is a problem because it will obviously create gaps that must be filled afterwards.

    But my true problem is that my images aren't aligned...

    here's my code:


            USHORT * buffer = (USHORT*) LockedRect.pBits;
            QImage depthImage(QSize(640,480),QImage::Format_RGB888);

            for (int y = 0; y < 240 ; y++)
                for (int x = 0; x < 320 ; x++)
                    USHORT depthBits = *buffer;
                        NUI_IMAGE_RESOLUTION_640x480, NULL,(LONG)x,(LONG)y,depthBits<<3,xInColorSpace,yInColorSpace)))

                        if (0 <= *xInColorSpace &&  *xInColorSpace < 640 && 0 <= *yInColorSpace && *yInColorSpace < 480)

                            QRgb ch = uShortToUchar_Depth( depthBits );



    and this is what I get:

    color image:


    transformed depth image over color image:



    I don't know why the images are not aligned, it's as if I needed to shift them on the x axis... can anyone help?

    Is there an easy way of "filling" the gaps in the resulting image? should I go through some sort of interpolation?

    • Edited by ragdad Monday, November 21, 2011 12:17 PM
    Monday, November 21, 2011 11:30 AM

All replies

  • I've written a small program to try to understand why I have such a poor alignment. I chose 4 points in the depth image and got their correspondents in the color image. Here is a snapshot  of what I get:


    If anyone has an idea, please let me know...


    • Edited by ragdad Monday, November 28, 2011 10:03 AM
    Tuesday, November 22, 2011 2:57 PM
  • You should do record which point you really map from Original depth map. And do interpolation from the recorded table
    Wednesday, November 23, 2011 12:44 PM
  • You should do record which point you really map from Original depth map. And do interpolation from the recorded table

    I didn't want to do anything fancy, I just wanted to try out the getcolorpixelfromdepthpixel and obviously there is a problem!

    So in the end, I juste did a tsai calibration of the cameras...

    It's a shame because it ends up being easier to do complex stuff than just using the built in functions.


    But if anyone has an idea of what's wrong(it may well be me...) I'm still interested to know.


    Monday, November 28, 2011 10:00 AM
  • Do you notice that after using the function  "getcolorpixelfromdepthpixel " the point you plot is a parallel shift?


    But actually not always a parallel shift for some pictures. I have tried 3D warping to get a pair of aligning depth map and RGB image.


    But it need to know the depth and camera parameter of RGB camera and depth camera . The calibration method I used is just like you.


    But the result after I doing the 3D warping is unsatisfactory. I refer to a paper relating to this , and the result is much better than using 3D warping.


    Maybe we can discuss through E-mail , I am doing the same thing like you. 

    • Edited by 夏飄雪 Tuesday, November 29, 2011 7:43 AM
    Tuesday, November 29, 2011 7:43 AM