/// <summary> /// Method for detecting a single person using the blob tracker /// </summary> /// <param name="source"></param> /// <returns></returns> public PointF?DetectSinglePerson(ITrackableSource source) { if (source == null) { return(null); } var kinectData = (KinectTrackableSource)source; if (!IsBackgroundCaptured) { CreteBackgroundReference(kinectData); return(null); } byte[] binaryImage = CreateBinaryImage(kinectData); if (blobTrackerMaskMat != null) { for (int i = 0; i < binaryImage.Length; i++) { if (blobTrackerMaskPixels[i] == 0) { binaryImage[i] = 0; } } } Mat binaryMatrix = new Mat(kinectData.FrameHeight, kinectData.FrameWidth, DepthType.Cv8U, 1); binaryMatrix.SetTo(binaryImage); using (var kp = DoBlobDetection(binaryMatrix)) { BlobsDetected = 0; if (kp.Size > 0) { BlobsDetected = kp.Size; return(kp[0].Point); } } return(null); }
/// <summary> /// Placeholder from interface /// Throws not implemented exception /// </summary> /// <param name="source"></param> /// <returns></returns> public Dictionary <int, PointF?> DetectMultiplePeople(ITrackableSource source) { throw new NotImplementedException("Simple Blob Tracker does not support multiple people yet"); }