Example #1
0
        private void SetDetectResult(IHandDetectResult source, FaceDetectionUpdateStatus status, TrackedHand dest)
        {
            dest.HasValidHandDetectResult = source.HasValidHandArea;
            if (!dest.HasValidHandDetectResult)
            {
                return;
            }

            //NOTE: こっから先では座標系の正規化をやってます
            dest.ReferenceFacePosition = new Vector2(

                status.FaceArea.center.x / status.Width - 0.5f,
                -status.FaceArea.center.y / status.Height + 0.5f
                );
            dest.ReferenceFaceSize = new Vector2(
                status.FaceArea.width / status.Width,
                status.FaceArea.height / status.Height
                );

            dest.HandPosition = new Vector2(
                source.HandAreaCenter.x / status.Width - 0.5f,
                -source.HandAreaCenter.y / status.Height + 0.5f
                );

            dest.HandSize = new Vector2(
                source.HandAreaSize.x / status.Width,
                source.HandAreaSize.y / status.Height
                );

            //NOTE: いったん信用できない値として扱っちゃいます
            dest.HandTopOrientation = new Vector2(0, 1);

            dest.ConvexDefectCount = source.ConvexDefectVectors.Count;
        }
Example #2
0
        private void OnFaceDetectionUpdated(FaceDetectionUpdateStatus status)
        {
            try
            {
                if (!ImageProcessEnabled)
                {
                    return;
                }

                if (status.HasValidFaceArea)
                {
                    _handAreaDetector.UpdateHandDetection(status.Image, status.Width, status.Height, status.FaceArea);
                }
                else
                {
                    _handAreaDetector.UpdateHandDetectionWithoutFace();
                }

                SetDetectResult(_handAreaDetector.LeftSideResult, status, LeftSideHand);
                SetDetectResult(_handAreaDetector.RightSideResult, status, RightSideHand);
            }
            catch (Exception ex)
            {
                LogOutput.Instance.Write(ex);
            }
        }
Example #3
0
 private void OnFaceDetectionUpdated(FaceDetectionUpdateStatus status)
 => _estimator.SetImageSize(status.Width, status.Height);