Пример #1
0
        async void Start()
        {
            sequence  = GetComponent <ITextureSequence>();
            converter = GetComponent <ITextureConverter>();
            detector  = GetComponent <IDetectService>();
            consumer  = FaceConsumer.GetComponent <IFaceListConsumer>();

            // start a logic loop
            IEnumerable <FaceData> faces = null;

            foreach (Task <Texture> request in sequence.Repeat())
            {
                if (request == null)
                {
                    continue;
                }

                var texture = await request;
                var image   = await converter.Convert(texture);

                var translator = await detector.Detect(ref image);

                faces = translator.Fetch <FaceData>(faces);
                if (faces != null)
                {
                    consumer.Consume(ref image, faces);
                }

                // release holding resources for detection
                translator.Dispose();
            }
        }
Пример #2
0
        public MainPageViewModel(INavigationService navigationService,
                                 IFileAccessService fileAccessService,
                                 IDetectService detectService)
            : base(navigationService)
        {
            this.Title = "Yolo V3";

            this._FileAccessService = fileAccessService;
            this._DetectService     = detectService;
            this._FilePickCommand   = new Lazy <DelegateCommand>(this.FilePickCommandFactory);
        }
Пример #3
0
        async void Start()
        {
            sequence  = GetComponent <ITextureSequence>();
            converter = GetComponent <ITextureConverter>();

            var detectors = GetComponents <IDetectService>();

            Debug.Log("Number of Detectors: " + detectors.Length);
            faceService = detectors[0];
            handService = detectors[1];

            faceConsumer = FaceConsumer.GetComponent <IFaceListConsumer>();
            handConsumer = HandConsumer.GetComponent <IHandListConsumer>();

            // start a logic loop
            IEnumerable <FaceData> faces = null;
            IEnumerable <HandData> hands = null;

            foreach (Task <Texture> request in sequence.Repeat())
            {
                if (request == null)
                {
                    continue;
                }

                var texture = await request;

                var image = await converter.Convert(texture);

                var faceTranslator = await faceService.Detect(ref image);

                faces = faceTranslator.Fetch <FaceData>(faces);
                if (faces != null)
                {
                    faceConsumer.Consume(ref image, faces);
                }
                //release holding resources for detection
                faceTranslator.Dispose();

                image = await converter.Convert(texture);

                var handTranslator = await handService.Detect(ref image);

                hands = handTranslator.Fetch <HandData>(hands);
                if (faces != null)
                {
                    handConsumer.Consume(ref image, hands);
                }
                //release holding resources for detection
                handTranslator.Dispose();
            }
        }
Пример #4
0
        public async void Start()
        {
            sequence  = GetComponent <ITextureSequence>();
            converter = GetComponent <ITextureConverter>();
            detector  = GetComponent <IDetectService>();
            consumer  = FaceConsumer.GetComponent <IFaceListConsumer>();


            IEnumerable <FaceData> faces = null;

            foreach (Task <Texture> request in sequence.Repeat())
            {
                if (request == null)
                {
                    continue;
                }

                var texture = await request;
                var image   = await converter.Convert(texture);

                var translator = await detector.Detect(ref image);

                faces = translator.Fetch <FaceData>(faces);
                if (faces != null)
                {
                    consumer.Consume(ref image, faces);
                }
                else
                {
                    faceDetected = false;
                }
                translator.Dispose();
                Debug.Log("face state: " + faceDetected);
                //faceDetected = false;
            }
        }