Problem when mapping depth to color coordinates

Problem when mapping depth to color coordinates


I tried to map depth to color coordinates using uvmap and I obtained this result:

I've got two issues. First, I've this large shift between the real location and the mapping. Second, I don't know why I've the end of my hand at the left of the frame. Here is my code:

        int cstride = cdata.pitches[0] / sizeof(pxcU32);
        int dstride = ddata.pitches[0] / sizeof(pxcU16);
        float * uvmap = (float *) ddata.planes[2];
        for(int y = 0; y < (int) dinfo.height; y++){
            for(int x = 0; x < (int) dinfo.width; x++){
                int cx = (int) (uvmap[(y*dstride + x)*2 + 0] * cinfo.width + 0.5f);
                int cy = (int) (uvmap[(y*dstride + x)*2 + 1] * cstride + 0.5f);
                short cz = ((short *) ddata.planes[0])[y * dstride + x];
                if(cx >= 0 && cx < (int) cinfo.width && cy >= 0 && cy < (int) cinfo.height && (int) cz < 700)
                    ((pxcU32 *)cdata.planes[0])[cy*cstride+cx] = 0xFFFFFFFF;

Can you help me to resolve these two issues ?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please use the calibration tool( compensate certain camera offset mapping depth to color coordinates. 

Thanks for your quick reply. I used the calibration tool as you said but the calibration was good. So I assume that it comes from my code.

Leave a Comment

Please sign in to add a comment. Not a member? Join today