Example #1
0
        /// <summary>
        /// Stores the latest face recognition results.
        /// </summary>
        /// <param name="newResultData">The results set to be stored.</param>
        private void StoreResult(FaceRecognitionResult newResultData)
        {
            Results.FaceRecognitionResults.Enqueue(newResultData);

            // Only keep the last n results for live display. Ensure by removing oldest results (FIFO).
            // Check defined constant 'MAX_COUNT_DISPLAY_FACES' to specify n.
            if (Results.FaceRecognitionResults.Count > MAX_COUNT_DISPLAY_FACES)
            {
                Results.FaceRecognitionResults.TryDequeue(out FaceRecognitionResult dequeuedResult);
            }
        }
Example #2
0
        /// <summary>
        /// Analyzes face recognition results for the image to be found under the given url.
        /// </summary>
        /// <param name="imageUrl">The url of the image which has been analyzed.</param>
        /// <param name="detectedFaces">The face recognition results as collection of face classes containing several attributes.</param>
        private void AnalyseResults(string imageUrl, IEnumerable <Face> detectedFaces)
        {
            var resultFaces = detectedFaces.ToList();
            var countResult = CountFaces(resultFaces);

            var newResultData = new FaceRecognitionResult(
                imageUrl,
                countResult.totalFaceCount,
                countResult.femaleFaceCount,
                countResult.totalFaceCount - countResult.femaleFaceCount);

            StoreResult(newResultData);
        }