コード例 #1
0
ファイル: PersonRecognizer.cs プロジェクト: tscholb/TizenFX
        private PersonRecognizedEventArgs CreatePersonRecognizedEventArgs(IntPtr result)
        {
            int count;

            GetResultValue(result, KeyCount, out count).Validate("Failed to get result count");

            var recognitionInfo = new PersonRecognitionInfo[count];

            if (count > 0)
            {
                var rects = new global::Interop.MediaVision.Rectangle[count];
                GetResultValue(result, KeyLocations, rects).Validate("Failed to get location");

                var labels = new int[count];
                GetResultValue(result, KeyLabels, labels).Validate("Failed to get label");

                var confidences = new double[count];
                GetResultValue(result, KeyConfidences, confidences).Validate("Failed to get confidence");

                for (int i = 0; i < count; i++)
                {
                    recognitionInfo[i] = new PersonRecognitionInfo(rects[i].ToApiStruct(),
                                                                   labels[i], confidences[i]);
                }
            }

            return(new PersonRecognizedEventArgs(recognitionInfo));
        }
コード例 #2
0
 internal ObjectDetectionResult(int indice, string name, float confidence,
                                global::Interop.MediaVision.Rectangle location)
 {
     Indice     = indice;
     Name       = name;
     Confidence = confidence;
     Location   = location.ToApiStruct();
 }
コード例 #3
0
        private static Rectangle[] GetResultAreas(IntPtr result, string countKey, string regionsKey)
        {
            int count = 0;

            GetResultValue(result, countKey, out count).Validate("Failed to get result");

            var rects = new global::Interop.MediaVision.Rectangle[count];

            if (count > 0)
            {
                GetResultValue(result, regionsKey, rects).Validate("Failed to get result");
            }

            return(global::Interop.ToApiStruct(rects));
        }
コード例 #4
0
ファイル: MovementDetector.cs プロジェクト: yourina/TizenFX
        private static Rectangle[] RetrieveAreas(IntPtr result)
        {
            int count = 0;

            GetResultValue(result, KeyNumberOfRegions, out count).Validate("Failed to get result count");

            if (count == 0)
            {
                return(new Rectangle[0]);
            }

            var rects = new global::Interop.MediaVision.Rectangle[count];

            GetResultValue(result, KeyRegions, rects).Validate("Failed to get regions");

            return(global::Interop.ToApiStruct(rects));
        }
コード例 #5
0
 internal FaceDetectionResult(float confidence, global::Interop.MediaVision.Rectangle location)
 {
     Confidence = confidence;
     Location   = location.ToApiStruct();
 }