My Kinect will be mounted on the ceiling looking downwards directly to the ground (should be paralell to ground). For object recognition i want to get the distance to the ground(maxDistance) and the distance to the object (minDistance). I wrote a loop that adds all distance values of each pixel to a list and then tried to get the Maximum int and the minimun of that list.
Unfortunately the result (that i am writing to a textbox, to check it) for zMIN and zMAX are always equally the same - which definetly is wrong.
QUESTION: What am i doing wrong? :)
List<int> tiefe = new List<int>();
for (var y = 0; y < height; y++)
{
for (var x = 0; x < width; x++)
{
var distance = GetDistance(depthdata[depthIndex], depthdata[depthIndex + 1]);
tiefe.Add(distance);
depthIndex += 2;
}
}
var zMAX = tiefe.Max();
var zMin = tiefe.Min();