public MainWindow() { _kinectSensor = KinectSensor.GetDefault(); _depthFrameDescription = _kinectSensor.DepthFrameSource.FrameDescription; _depthFrameReader = _kinectSensor.DepthFrameSource.OpenReader(); _depthFrameReader.FrameArrived += Reader_FrameArrived; _cameraSpacePoints = new CameraSpacePoint[_depthFrameDescription.Width * _depthFrameDescription.Height]; _trackingDiagnostics = new TrackingDiagnostics(); _heatMap = new HeatMap(); _energyHistory = new EnergyHistory(); _temporalMedianImage = new TemporalMedianImage(GlobVar.TemporalFrameCounter); _stopwatch = new Stopwatch(); BodiesHistory.Initialize(); GlobVar.CoordinateMapper = _kinectSensor.CoordinateMapper; GlobVar.TimeStamps = new List <TimeSpan>(); // initialize the components (controls) of the GUI window InitializeComponent(); _kinectSensor.Open(); }
/// <summary> /// Performs body tracking on frame /// </summary> private void TrackBodies(TimeSpan frameRelativeTime, CameraSpacePoint[] noiseFilteredFrame) { var validatedHeads = DetectHeads(noiseFilteredFrame); _stopwatch.Restart(); GeodesicUtils.CreateGeodesicGraph(noiseFilteredFrame); if (Logger.LogTimeGeodesic) { _stopwatch.Stop(); Console.WriteLine("CreateGeodesicGraph: {0}", _stopwatch.ElapsedMilliseconds); } _stopwatch.Restart(); var bodies = CreateBodies(frameRelativeTime, validatedHeads); BodiesHistory.Update(bodies); GlobVar.TimeStamps.Add(frameRelativeTime); TrackingDiagnostics.AddNewBodyFrame(bodies); _heatMap.AddFrame(GlobVar.HeatCanvas); EnergyHistory.Update(bodies); if (Logger.PrintFps) { var currentTime = frameRelativeTime; Console.WriteLine("FPS: {0}", Logger.CalculateFps(currentTime, _timestampPreviousFrame)); _timestampPreviousFrame = currentTime; } }
public MainWindow() { _kinectSensor = KinectSensor.GetDefault(); _depthFrameDescription = _kinectSensor.DepthFrameSource.FrameDescription; _depthFrameReader = _kinectSensor.DepthFrameSource.OpenReader(); _depthFrameReader.FrameArrived += Reader_FrameArrived; _cameraSpacePoints = new CameraSpacePoint[_depthFrameDescription.Width * _depthFrameDescription.Height]; _trackingDiagnostics = new TrackingDiagnostics(); _heatMap = new HeatMap(); _energyHistory = new EnergyHistory(); _temporalMedianImage = new TemporalMedianImage(GlobVar.TemporalFrameCounter); _stopwatch = new Stopwatch(); BodiesHistory.Initialize(); GlobVar.CoordinateMapper = _kinectSensor.CoordinateMapper; GlobVar.TimeStamps = new List<TimeSpan>(); // initialize the components (controls) of the GUI window InitializeComponent(); _kinectSensor.Open(); }
private void PostProcessing() { if (Logger.PrintTotalFps) { Console.WriteLine("TotalFPS: {0}", Logger.CalculateAverageFps(GlobVar.TimeStamps)); } TrackingDiagnostics.CalculateTrackingSuccess(); var statWindow = new StatisticsWindow(); statWindow.Draw(_heatMap.Get(), _energyHistory.Get(), GlobVar.TimeStamps); }