public IDictionary <TrackingMarker, Point3D> Convert2DTrackingPointsTo3DTrackingPoints( IDictionary <TrackingMarker, Point2D> trackingPoints2D, DepthFormat dFormat, ICollection <short> depthShorts, ColourFormat cFormat) { var kdFormat = FormatConvertor.ConvertToKinect(dFormat); var kcFormat = FormatConvertor.ConvertToKinect(cFormat); var dShorts = depthShorts.ToArray(); // HACK!!!!!!!!!!!!!!!! return(_ConvertColourPointsToWorldPoints(trackingPoints2D, kdFormat, dShorts, kcFormat)); }
public ICollection <Point3D> GeneratePointCloud(DepthFormat dFormat, ICollection <short> depthShorts, ColourFormat cFormat, ICollection <byte> colourPixels) { var kdFormat = FormatConvertor.ConvertToKinect(dFormat); var kcFormat = FormatConvertor.ConvertToKinect(cFormat); var dWidth = FormatConvertor.PixelWidth(kdFormat); var cWidth = FormatConvertor.PixelWidth(kcFormat); var points = new List <Point3D>(); var d = depthShorts.ToArray(); var c = colourPixels.ToArray(); for (int i = 0; i < d.Length; i++) { var depth = (short)(d[i] >> 3); if (depth < 0) { continue; } var dip = new DepthImagePoint() { Depth = depth, X = i % dWidth, Y = i / dWidth }; var skel = this.mapper.MapDepthPointToSkeletonPoint(kdFormat, dip); var cip = this.mapper.MapDepthPointToColorPoint(kdFormat, dip, kcFormat); var cIndex = 4 * (cip.X + cip.Y * cWidth); if (cIndex > c.Length || cIndex < 0) { continue; } var r = c[cIndex + 2]; var g = c[cIndex + 1]; var b = c[cIndex]; points.Add(new Point3D(skel.X, skel.Y, skel.Z, r, g, b)); } return(points); }
public SensorManager(DepthFormat dFormat, ColourFormat cFormat) { this.desiredDepthFormat = FormatConvertor.ConvertToKinect(dFormat); this.desiredColourFormat = FormatConvertor.ConvertToKinect(cFormat); this.frameReadyEventsRegistered = false; }