Hello Boris,

I have found some aproximate solution like y= a * tan( (x-b)*c) +d

Using the CLNUIDevice.dll is fairly easy.

Just invoke CLNUIDevice.h + the lib and dll

Here’s some code to read out the depthmap and map into into real spacial coordinates:

( sorry for posting that much .. )

============================================

============================================

typedef double point3[3];

//————————————————————————————————————

int vecNorm( point3 p, point3 res)

//————————————————————————————————————

{

int i;

double s;

for (s=0.,i=0;i

<3;i++)s+=(p

**p**);*

if (s==0.0) return 0;

s=sqrt(s);

for (i=0;i

*<3;i++)res*

*=p**/s;*

return 1;

}

//————————————————————————————————————

void vecScale( point3 p, double s )

//————————————————————————————————————

{ p[0]*=s;p[1]*=s;p[2]*=s;}

*
*//————————————————————————————————————

double vecMult( point3 a,point3 b)

//————————————————————————————————————

{

return(a[0]*b[0]+a[1]*b[1]+a[2]*b[2]);

}

//———————————————————————————————————————————

double *map2space( double *pp )

//———————————————————————————————————————————

// just an aproximate solution from empiric data

{

static double p[3];

// pp[0] 0.. 640

// pp[1] 0.. 480

// pp[2] 300 .. 1090

double pi=3.1415926535897932384626433832795;

double a,b,c,d;

a=50;

b=0;

c=0.0014410975475182537791113043042567;

d=12;

double s,sc,x,y,z;

s=pp[2];

s=a*tan((s-b)*c)+d; // map kinect -> cm

p[0]=(pp[0]-240);

p[1]=-(pp[1]-320);

p[2]=620; // aproximate focal length

double n[3]={0,0,1};

vecNorm(p,p);

sc=1/vecMult(p,n); // 1/cos(phi)

vecScale(p,s*sc);

return p;

}

//———————————————————————————————————————————

void DoCam()

//———————————————————————————————————————————

{

CLNUICamera cam;

PDWORD pData;

cam=CreateNUICamera();

StartNUICamera(cam);

bool ret;

ret=GetNUICameraDepthFrameRAW(cam, ( PUSHORT )pData, 500 );

PUSHORT lpU;

unsigned short u;

int ik,jk;

double x,y,z;

double p[3]={0,0,0},*pS;

int m=480; // Meshcount in X

int n=640; // Meshcount in Y

int dd=1;

p[2]=0;

// Read out the depth-Buffer, convert pixel into point in 3D-space

for (lpU=( PUSHORT )pData,i=0;i
for (j=0;j
{ u=*lpU;

lpU++;

p[0]=(double)i;

p[1]=(double)j;

if (u > 0 && u < 2044 )

p[2]=(double)u;

pS=map2space(p);

NOW_HAVE_SOME_FUN_WITH_THAT_POINT_IN_3D( pS ); //:-))

}

StopNUICamera(cam);

DestroyNUICamera(cam);

}