Tuesday, April 12, 2011

Editing Sample Code

While testing the Kinect we came across a sample code segment called NiSimpleRead. This program took in the data from the Kinect and printed out the depth in the middle of the sensor. By editing the C# source file, we made a modified version that found the closest and furthest point in the Kinect's view.

The next thing we did was try to figure out how to alert the user to a nearby object. We first thought about having the camera identify the closest object and buzz the respective buzzer based on the objects x-position. We then thought about dividing the vision into three segments for each buzzer. We could then find three of the closest points in each section and vibrate each buzzer based on the distance.

But, this would cause problems when an item was in between two zones. We eventually decided that the best way to determine which buzzer to buzz was by having the three zones overlap. Each buzzer would correspond to 1/2 of the Kinect''s view and each frame would correspond to a buzzer. We would then average the z-distance of each pixel in each of the buzzers frame and adjust the buzzers based on this average.

We programed the Kinect to report the average distance of each zone, but we cannot determine if this is the best method yet. We may have to weight the average if the object is closer to the middle of the screen, or if the object is lower. We will not know the best method of doing this until we have the entire system rigged up.