/// <summary>
        /// Creates a new skeletal system
        /// </summary>
        /// <param name="skelType">The skeletal system type to create</param>
        public Skeleton(SkeletonType skelType) : this()
        {
            createSkeleton();
            switch (skelType)
            {
            case SkeletonType.UpperBody:
                break;

            case SkeletonType.LowerBody:
                break;

            case SkeletonType.MidBody:
                break;

            case SkeletonType.Dog:
                break;

            case SkeletonType.TRex:
                break;

            default:
                break;
            }

            /** set up the timer ONLY after the skeleton has been created, otherwise bad stuff happens */
            initializeTimer();
        }
Пример #2
0
        public static void AddMultilinesLayers(this CALayer This, int lines, SkeletonType type, int lastLineFillPercent)
        {
            var config = SkeletonConfig.Default.Clone() as SkeletonConfig;

            config.MultilineLastLineFillPercent = lastLineFillPercent;
            AddMultilinesLayers(This, lines, type, config);
        }
Пример #3
0
 //得到标定时 初始的 镜像 转 正常 的骨架信息 屏幕百分比坐标
 public Vector3 GetTrackingScreenPercentPos(SkeletonType skeletonType)
 {
     if (_trackingBoneScreenPercentPosDict != null && _trackingBoneScreenPercentPosDict.Count > 0)
     {
         return(_trackingBoneScreenPercentPosDict [skeletonType]);
     }
     return(Vector3.zero);
 }
Пример #4
0
 //得到标定时 初始的 镜像 转 正常 的骨架信息 世界坐标
 public Vector3 GetTrackingWorldPos(SkeletonType skeletonType)
 {
     if (_trackingBoneWorldPosDict != null && _trackingBoneWorldPosDict.Count > 0)
     {
         return(_trackingBoneWorldPosDict [skeletonType]);
     }
     return(Vector3.zero);
 }
Пример #5
0
 public Instructions(ObjectType mainType, bool useOnce, SkeletonType skeletonType,
                     Dictionary <PixelInfo, PixelInfo> palette = null)
 {
     MainType     = mainType;
     UseOnce      = useOnce;
     Palette      = palette;
     SkeletonType = skeletonType;
 }
        public static CALayer MakeMultilineLayer(SkeletonType type, int index, nfloat width, SkeletonConfig config)
        {
            var layer = type.GetLayer();

            layer.AnchorPoint = CGPoint.Empty;
            layer.Name        = CALayerExtensions.SkeletonSubLayersName;
            layer.Frame       = new CGRect(0, index * config.SpaceRequiredForEachLine, width, config.MultilineHeight);
            return(layer);
        }
 public SkeletonLayer(SkeletonType type, UIColor[] colors, UIView holder)
 {
     SkeletonType             = type;
     _weakRefHolder           = new WeakReference <UIView>(holder);
     ContentLayer             = type.GetLayer();
     ContentLayer.AnchorPoint = CGPoint.Empty;
     ContentLayer.Bounds      = holder.MaxBoundsEstimated();
     AddMultilinesIfNeeded();
     ContentLayer.Tint(colors);
 }
Пример #8
0
 //得到镜像 转 正常 的骨架信息 世界坐标
 public static Vector3 GetWorldPos(OrbbecUser user, SkeletonType skeletonType)
 {
     if (IsUserActive(user))
     {
         SkeletonType skeletonType2 = OrbbecUtils.GetFlipSkeletonType(skeletonType);
         Vector3      vec           = user.BoneWorldPos[jointToIntDict[skeletonType2]];
         return(vec);
     }
     return(Vector3.zero);
 }
Пример #9
0
        public Skeleton(string filepath, Signal signal, int width = 640, int height = 480)
        {
            this.filepath = filepath;
            this.signal   = signal;
            this.width    = width;
            this.height   = height;

            type     = MediaType.SKELETON;
            skelType = SkeletonType.NONE;

            BackColor   = Defaults.Colors.Background;
            SignalColor = Defaults.Colors.Foreground;
            HeadColor   = Colors.YellowGreen; // Defaults.Colors.Foreground;

            numSkeletons = 0;
            if (signal.Meta.ContainsKey("num"))
            {
                int.TryParse(signal.Meta["num"], out numSkeletons);
            }

            numJoints = 0;
            if (signal.Meta.ContainsKey("type"))
            {
                if (signal.Meta["type"] == "ssi")
                {
                    skelType  = SkeletonType.SSI;
                    numJoints = 25;
                }
                else if (signal.Meta["type"] == "kinect1")
                {
                    skelType  = SkeletonType.KINECT1;
                    numJoints = 20;
                }
                else if (signal.Meta["type"] == "kinect2")
                {
                    skelType  = SkeletonType.KINECT2;
                    numJoints = 25;
                }
            }

            jointValues = 0;
            if (numSkeletons > 0 && numJoints > 0)
            {
                jointValues = (int)((signal.dim / numSkeletons) / numJoints);
            }

            writeableBmp = new WriteableBitmap(width, height, 96.0, 96.0, PixelFormats.Bgr32, null);
            writeableBmp.Clear(BackColor);

            Source = writeableBmp;

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(1000.0 / signal.rate);
            timer.Tick    += new EventHandler(Draw);
        }
Пример #10
0
 //得到镜像 转 正常 的骨架的 屏幕百分比数据
 public static Vector3 GetScreenPercentPos(OrbbecUser user, SkeletonType skeletonType)
 {
     if (IsUserActive(user))
     {
         SkeletonType skeletonType2 = OrbbecUtils.GetFlipSkeletonType(skeletonType);
         Vector3      vec           = user.BoneScreenPos[jointToIntDict[skeletonType2]];
         vec = new Vector3(vec.x / depthSize.x, (depthSize.y - vec.y) / depthSize.y, 1f);
         return(vec);
     }
     return(Vector3.zero);
 }
Пример #11
0
 private static string FbxBoneNameFromBoneId(SkeletonType skeletonType, BoneId bi)
 {
     if (bi >= BoneId.Hand_ThumbTip && bi <= BoneId.Hand_PinkyTip)
     {
         return(_handPrefix[(int)skeletonType] + _fbxFingerNames[(int)bi - (int)BoneId.Hand_ThumbTip] + "_finger_tip_marker");
     }
     else
     {
         return("b_" + _handPrefix[(int)skeletonType] + _fbxBoneNames[(int)bi]);
     }
 }
Пример #12
0
    private void EnableNormalSkeleton()
    {
        characterAimBase.SetVObjectEnabled(false);
        characterAimBase.enabled = false;
        playerAim.enabled        = false;

        playerBase.enabled  = true;
        playerPunch.enabled = true;
        playerSword.enabled = true;
        playerBase.RefreshBodySkeletonMesh();

        skeletonType = SkeletonType.Normal;
    }
Пример #13
0
    private void EnableAimSkeleton()
    {
        playerBase.enabled  = false;
        playerPunch.enabled = false;
        playerSword.enabled = false;

        characterAimBase.SetVObjectEnabled(true);
        characterAimBase.enabled = true;
        characterAimBase.RefreshBodySkeletonMesh();
        playerAim.enabled = true;

        skeletonType = SkeletonType.Aim;
    }
        public static CALayer GetLayer(this SkeletonType This)
        {
            switch (This)
            {
            case SkeletonType.Solid:
                return(new CALayer());

            case SkeletonType.Grandient:
                return(new CAGradientLayer());

            default:
                throw new NotSupportedException();
            }
        }
Пример #15
0
        public void CleanupLayers(AssemblerResource <T> res, SkeletonType skeletonType)
        {
            if (skeletonType == SkeletonType.Anchors)
            {
                ImageTools.ExtractAnchors(res.Data);
            }

            if (res.SplitLayers != null && res.SplitLayers.Any())
            {
                foreach (var layer in res.SplitLayers)
                {
                    ImageTools.Merge(res.Data, layer.image, 0, 0, layer.Anchor.X, layer.Anchor.Y);
                }
            }
        }
Пример #16
0
        public static void AddMultilinesLayers(this CALayer This, int lines, SkeletonType type, SkeletonConfig config)
        {
            var numberOfSublayers = CalculateNumLines(This, lines, config);
            var width             = This.Bounds.Width;

            for (var index = 0; index < numberOfSublayers; index++)
            {
                if (index == numberOfSublayers - 1 && numberOfSublayers != 1)
                {
                    width = width * (config.MultilineLastLineFillPercent / 100f);
                }
                var layer = SkeletonLayerFactory.MakeMultilineLayer(type, index, width, config);
                This.AddSublayer(layer);
            }
        }
Пример #17
0
    private void Awake()
    {
        characterAimBase = GetComponent <CharacterAim_Base>();
        playerAim        = GetComponent <PlayerAim>();
        playerBase       = GetComponent <Character_Base>();
        playerPunch      = GetComponent <PlayerPunch>();
        playerSword      = GetComponent <PlayerSword>();

        playerBase.enabled  = false;
        playerPunch.enabled = false;
        playerSword.enabled = false;

        skeletonType = SkeletonType.Aim;

        characterAimBase.OnShoot += CharacterAimBase_OnShoot;
    }
Пример #18
0
        public Skeleton(BooleanMatrix binary, SkeletonType type)
        {
            Type = type;
            // https://sourceafis.machinezoo.com/transparency/binarized-skeleton
            FingerprintTransparency.Current.Log(Prefix(Type) + "binarized-skeleton", binary);
            Size = binary.Size;
            var thinned       = Thin(binary);
            var minutiaPoints = FindMinutiae(thinned);
            var linking       = LinkNeighboringMinutiae(minutiaPoints);
            var minutiaMap    = MinutiaCenters(linking);

            TraceRidges(thinned, minutiaMap);
            FixLinkingGaps();
            // https://sourceafis.machinezoo.com/transparency/traced-skeleton
            FingerprintTransparency.Current.LogSkeleton("traced-skeleton", this);
            Filter();
        }
        public static SkeletonLayerAnimation GetLayerAnimation(this SkeletonType This)
        {
            return((layer) =>
            {
                switch (This)
                {
                case SkeletonType.Solid:
                    return layer.Pulse();

                case SkeletonType.Grandient:
                    return layer.Sliding();

                default:
                    throw new NotSupportedException();
                }
            });
        }
Пример #20
0
        public static void ShowSkeleton(
            this UIView This, UIColor[] colors,
            SkeletonType type = SkeletonType.Solid,
            bool animated     = false,
            SkeletonLayerAnimation animation = null)
        {
            AddDummyDataSourceIfNeeded(This);
            var views = SubviewsSkeletonables(This);

            views.RecursiveSearch(() =>
            {
                if (This.IsSkeletonActive())
                {
                    return;
                }
                This.UserInteractionEnabled = false;
                This.PrepareForSkeleton();
                AddSkeletonLayer(This, colors, type, animated: animated, animation: animation);
            }, (v) => v.ShowSkeleton(colors, type, animated, animation));
        }
Пример #21
0
    public void TryAutoMapBonesByName()
    {
        BoneId       start        = GetCurrentStartBoneId();
        BoneId       end          = GetCurrentEndBoneId();
        SkeletonType skeletonType = GetSkeletonType();

        if (start != BoneId.Invalid && end != BoneId.Invalid)
        {
            for (int bi = (int)start; bi < (int)end; ++bi)
            {
                string    fbxBoneName = FbxBoneNameFromBoneId(skeletonType, (BoneId)bi);
                Transform t           = transform.FindChildRecursive(fbxBoneName);

                if (t != null)
                {
                    _customBones[(int)bi] = t;
                }
            }
        }
    }
Пример #22
0
        public static void AddSkeletonLayer(
            this UIView This,
            UIColor[] colors, SkeletonType type,
            GradientDirection?direction = null, bool animated = false, SkeletonLayerAnimation animation = null)
        {
            var skeletonLayer = SkeletonLayerFactory.MakeLayer(type, colors, This);

            if (direction.HasValue && animation == null)
            {
                animation = direction.Value.SlidingAnimation();
            }

            This.SetSkeletonLayer(skeletonLayer);

            This.Layer.InsertSublayer(skeletonLayer.ContentLayer, int.MaxValue);
            if (animated)
            {
                skeletonLayer.StartAnimation(animation);
            }
            This.SetSkeletonStatus(Views.Status.On);
        }
Пример #23
0
    private void Awake()
    {
        if (_dataProvider == null)
        {
            _dataProvider = GetComponent <IOVRSkeletonDataProvider>();
        }

        _bones = new List <OVRBone>();
        Bones  = _bones.AsReadOnly();

        _bindPoses = new List <OVRBone>();
        BindPoses  = _bindPoses.AsReadOnly();

        _capsules = new List <OVRBoneCapsule>();
        Capsules  = _capsules.AsReadOnly();

        if (_dataProvider != null)
        {
            _skeletonType = _dataProvider.GetSkeletonType();
        }
    }
Пример #24
0
        public AssemblerResource <T> Assemble(List <AssemblerResource <T> > resources,
                                              SkeletonType skeletonType,
                                              Overlay overlay     = null,
                                              ObjectType mainType = ObjectType.na,
                                              Dictionary <PixelInfo, PixelInfo> palette = null)
        {
            var useAnchors = skeletonType == SkeletonType.Anchors;

            if (overlay != null || skeletonType == SkeletonType.Anchors)
            {
                var width  = !useAnchors ? overlay.Width : resources.Max(r => r.Data.Width);
                var height = !useAnchors ? overlay.Height : resources.Max(r => r.Data.Height);
                var canvas = ImageTools.BlankCanvas(width, height);
                resources.Insert(0, AssemblerResource <T> .Canvas(canvas));
            }
            var assembled = resources.Aggregate((res, next) => Merge(res, next, skeletonType, overlay));

            CleanupLayers(assembled, skeletonType);

            // TODO, IMPORTANT - this somehow breaks the loader's definitions!
            // It replaces the type in the original resource definition
            if (mainType != ObjectType.na)
            {
                assembled.Definition.ObjectType = mainType;
            }

            assembled.Data   = ImageTools.Trim(assembled.Data);
            assembled.Colors = ImageTools.ColorInfo(assembled.Data);

            if (palette != null)
            {
                ImageTools.ApplyPalette(assembled.Data, palette);
            }

            assembled.Data.Apply();

            return(assembled);
        }
Пример #25
0
        //骨骼模型 并不包含mesh和材质 骨骼需要与模型配套 本例中没有严格遵守配套规则
        public static string GetSkeletonName(SkeletonType skeletonType)
        {
            //获取Prefab的方法:
            //一:表格 便于策划填表和修改 每次修改后需要重新导表 物体顺序基于表格中同类顺序
            //二:获取enum名 在代码中直接定义 Enum.GetName(color.GetType(), color); 需要严格遵守文件名规则
            //三:本例中的赋值操作 需要手动赋值一次

            string skeleton = "";

            switch (skeletonType)
            {
            case SkeletonType.Man:
                skeleton = "ch_pc_hou_ZhanShi";
                break;

            case SkeletonType.Women:
                skeleton = "ch_pc_hou_FaShi";
                break;

            default:     //不存在的记录将读取资源报错
                break;
            }
            return(skeleton);
        }
Пример #26
0
 /// <summary>
 /// 获取骨架的旋转信息
 /// </summary>
 /// <param name="UserID">用户ID</param>
 /// <param name="Type">骨架枚举类型</param>
 /// <param name="Confidence">坐标点可信度</param>
 /// <param name="flip">是否反转</param>
 /// <returns></returns>
 public Quaternion GetSkeletonRotation(int UserID, SkeletonType Type, ref float Confidence, bool flip)
 {
     return(m_Wrapper.GetSkeletonRotation(UserID, Type, ref Confidence, flip));
 }
Пример #27
0
 /// <summary>
 /// 获取骨架屏幕百分比坐标
 /// </summary>
 /// <param name="UserID">用户ID</param>
 /// <param name="Type">骨架枚举类型</param>
 /// <param name="Confidence">坐标点可信度</param>
 /// <returns></returns>
 public Vector3 GetSkeletonScreenPercentPos(int UserID, SkeletonType Type, ref float Confidence)
 {
     return(m_Wrapper.GetSkeletonScreenPercentPos(UserID, Type, ref Confidence));
 }
Пример #28
0
 public bool IsSkeletonAvailable(SkeletonType Type)
 {
     return(m_Wrapper.IsSkeletonAvailable(Type));
 }
Пример #29
0
 public static string Prefix(SkeletonType type)
 {
     return(type == SkeletonType.Ridges ? "ridges-" : "valleys-");
 }
 public static SkeletonLayer MakeLayer(SkeletonType type, UIColor[] colors, UIView holder)
 {
     return(new SkeletonLayer(type, colors, holder));
 }