how to change current depth map and display it

53 views
Skip to first unread message

Tal

unread,
Aug 28, 2012, 5:38:08 AM8/28/12
to openn...@googlegroups.com
hello,
I tried to change my depth image and to display it with glutDisplay.
I wrote the following code:
XnPoint3D projection, pPosition2;
                pPosition2.X=handXPos;
                pPosition2.Y=handYPos;
                pPosition2.Z=handZPos;
                printf(" position drewSquare: (%f, %f, %f)\n", pPosition2.X,pPosition2.Y,pPosition2.Z);
                g_depth.ConvertRealWorldToProjective(1,&pPosition2,&projection);

               
                g_depth.GetMetaData(g_depthMD);
                XnDepthPixel* depth = g_depthMD.WritableData();
                const XnDepthPixel* depthData = g_depthMD.Data();
                int x = projection.X;
                int y = projection.Y;
                int handDepth = depthData[y*g_depthMD.XRes() + x];
                printf("X projection: %d, Y projection: %d\n",x,y);
                for (int i = -100; i<100; i++) {
                    for (int j = -100; j<100; j++){
                        depth[(y+j)*g_depthMD.XRes() + (i+x)] = 0;
                        //g_depthMD.WritableData()[(y+j)*g_depthMD.XRes() + (i+x)]=0;
                       
                    }
                }

Tal

unread,
Aug 28, 2012, 5:44:20 AM8/28/12
to openn...@googlegroups.com

the code above try to create a black square in some area of the depth map
from reason I don't understand it displays the regular depth map without the change.
I guess I need to update the depth map (g_depthMD and\ or g_depth) by the new created depth map ('depth' as called above) but I don't know how.

thanks in advance


 
Reply all
Reply to author
Forward
0 new messages