protected override void StartProcessing(IReadOnlyDictionary <FrameType, Frame> frames) { var depthFrame = frames[FrameType.Depth]; var undistorted = new Frame(depthFrame.Width, depthFrame.Height, FrameDataFormat.Float); var registered = new Frame(depthFrame.Width, depthFrame.Height, FrameDataFormat.Bgrx); _registration.Apply(frames[FrameType.Color], depthFrame, undistorted, registered); _outQueue.Enqueue(FrameType.Depth, undistorted); _outQueue.Enqueue(FrameType.Color, registered); OnProcessingFinished(frames); }
public bool OnNewFrame(FrameType frameType, Frame frame) { var reportToLog = false; long colorCount, depthCount, infraRedCount, errors; lock (_stopwatch) { switch (frameType) { case FrameType.Color: _colorCount++; break; case FrameType.Depth: _depthCount++; break; case FrameType.InfraRed: _infraRedCount++; break; } if (frame.HasError) { _errors++; } colorCount = _colorCount; depthCount = _depthCount; infraRedCount = _infraRedCount; errors = _errors; if (_stopwatch.Elapsed >= LogInterval) { reportToLog = true; _stopwatch.Restart(); } } if (reportToLog) { var message = $"Recent frame: type={frameType}, data format={frame.DataFormat}, timestamp={frame.TimeStamp}, sequence={frame.Sequence}, width={frame.Width}, height={frame.Height}, bpp={frame.BytesPerPixel}, has error={frame.HasError}"; _logger.Invoke(message); message = $"Total frames received: color={colorCount}, depth={depthCount}, infra red={infraRedCount}, errors={errors}"; _logger.Invoke(message); } if (!frame.HasError) { _queue.Enqueue(frameType, frame); } return(true); }