how to draw a bounding box wihtout Coordinate Mapper

• Question

• Hello,

i'm trying to draw a bounding box arround the detected skeleton.

The Tops of the box are calculated from the max and min of joint coordinates on x, y and z.

so when i have those 8 values i saved them into a dictionary like this :

```readonly Dictionary<int, List<Sommet>> displayBox = new Dictionary<int, List<Sommet>>();

{
var trackingID = skeleton.TrackingId;

if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
{
foreach (Joint j in skeleton.Joints)
{

float jx = j.Position.X;
float jy = j.Position.Y;
float jz = j.Position.Z;

// Populate min and max X.
if (jx < minX)
{
minX = jx;
}
if (jx > maxX)
{
maxX = jx;
}

// Populate min and max Y
if (jy < minY)
{
minY = jy;
}
if (jy > maxY)
{
maxY = jy;
}

// Populate min and max Z
if (jz < minZ)
{
minZ = jz;
}
if (jz > maxZ)
{
maxZ = jz;
}
}
Vector3 a = new Vector3(maxX, maxY, minZ);
Vector3 b = new Vector3(minX, maxY, minZ);
Vector3 c = new Vector3(minX, maxY, maxZ);
Vector3 d = new Vector3(maxX, maxY, maxZ);
Vector3 e = new Vector3(maxX, minY, minZ);
Vector3 f = new Vector3(minX, minY, maxZ);
Vector3 g = new Vector3(minX, minY, maxZ);
Vector3 h = new Vector3(maxX, minY, maxZ);
addSommet(a, b, c, d, e, f, g, h, trackingID);
}

}

public void addSommet(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 e, Vector3 f, Vector3 g, Vector3 h, int trackingID)
{
if (!displayBox.ContainsKey(trackingID))
{
}

displayBox[trackingID].Add(new Sommet() { ai = a, bi = b, ci = c, di = d, ei = e, fi = f, gi = g, hi = h });

if (displayBox[trackingID].Count > 90)
{
displayBox[trackingID].RemoveAt(0);
}

}```

and finally, the class sommet looks like :

``` class Sommet
{
public Vector3 ai
{
get;
set;
}

public Vector3 bi
{
get;
set;
}

public Vector3 ci
{
get;
set;
}

public Vector3 di
{
get;
set;
}

public Vector3 ei
{
get;
set;
}
public Vector3 fi
{
get;
set;
}

public Vector3 gi
{
get;
set;
}
public Vector3 hi
{
get;
set;
}
}```

my question is :

if i want to use the plot and draw methods of skeletonViewer example, i will need to use the coordianteMapper methods such as MapDepthPointToColorPoint(), however those methods need a skeleton point or depth point as entries and not a vector3.

So to convert my 3D tops from depth to color i have to use another method.

have you any idea hwo to do that ?

thanks for any help

DKF

• Edited by Tuesday, June 16, 2015 2:41 PM
Tuesday, June 16, 2015 2:40 PM