public void ConvertKinectToRealWorld(IKinectToRealWorldStrategy kinectToRealWorldStrategy) { var kinectPoints = beamerToKinect.Values.ToList(); var newPoints = kinectToRealWorldStrategy.TransformKinectToRealWorld(kinect, kinectPoints); foreach (var element in newPoints) { kinectToRealWorld.Add(element.Key, element.Value); } }
public void ConvertKinectToRealWorld(IKinectToRealWorldStrategy kinectToRealWorldStrategy, List<KinectPoint> kinectPoints) { var newPoints = kinectToRealWorldStrategy.TransformKinectToRealWorld(kinect, kinectPoints); foreach (var element in newPoints) { var point = new Point(); point.Name = "ObstacleCentroid"; point.KinectPoint = element.Key; point.RealWorldPoint = element.Value; Calibration.Points.Add(point); } }
public byte[] CompareZCalcStrategies(IKinectToRealWorldStrategy kinectToRealWorldStrategy) { var kinectPoints = kinect.CreateKinectPointArray(); var kinectPointsList = new List<KinectPoint>(); for (int y = 0; y < Kinect.Kinect.KINECT_IMAGE_HEIGHT; ++y) { for (int x = 0; x < Kinect.Kinect.KINECT_IMAGE_WIDTH; ++x) kinectPointsList.Add(kinectPoints[x, y]); } var dictPoints = kinectToRealWorldStrategy.TransformKinectToRealWorld(kinect, kinectPointsList); var diffPoints = new KinectPoint[Kinect.Kinect.KINECT_IMAGE_WIDTH, Kinect.Kinect.KINECT_IMAGE_HEIGHT]; var differences = new List<int>(); foreach (var p in dictPoints) { differences.Add(p.Key.Z - p.Value.Z); } differences.Sort(); var maxDiff = differences.Max(); var minDiff = differences.Min(); var rangeDiff = maxDiff - minDiff; var r = 0x80; var g = 0x80; var b = 0x80; foreach (var p in dictPoints) { int diff = p.Key.Z - p.Value.Z; //diff positiv --> gegen weiss, diff negativ --> gegen schwarz if (diff == 0) { r = 0x00; b = 0x00; g = 0xFF; } else { r = 0x80 + (int)(diff * 127.0 / rangeDiff); g = 0x80 + (int)(diff * 127.0 / rangeDiff); b = 0x80 + (int)(diff * 127.0 / rangeDiff); } diffPoints[p.Key.X, p.Key.Y] = new KinectPoint(p.Key.X, p.Key.Y, diff, r, g, b); } var edgepoints = Calibration.GetEdgePoints(); foreach (var edgepoint in edgepoints) { var x = edgepoint.KinectPoint.X; var y = edgepoint.KinectPoint.Y; diffPoints[x, y] = new KinectPoint(x, y, 0x00, 0x00, 0xFF); } return kinect.ConvertKinectPointArrayToByteArray(diffPoints, Kinect.Kinect.KINECT_IMAGE_WIDTH, Kinect.Kinect.KINECT_IMAGE_HEIGHT); }