Beispiel #1
0
        /// <summary>
        /// テーブルに表情データを追加する。
        /// </summary>
        /// <param name="ModelPath"></param>
        /// <param name="expression"></param>
        public void Add(string ModelPath, LiplisMotion expression)
        {
            //モーションパス取得
            var path = ModelPath + ModelPathDefine.EXPRESSIONS + "/" + expression.FileName;

            //対象エモーションにファイルを追加する。
            TableExpression[(int)MotionMap.GetMotion(expression.Emotion, expression.Emotion)].Add(expression.FileName);

            //ModelJsonオブジェクト取得
            var model3Json = CubismMotion3Json.LoadFrom(AssetLoader.LoadAsset <string>(path));

            //アニメーションクリップテーブルに追加
            TabelAnimationClip.Add(expression.FileName, model3Json.ToAnimationClip());
        }
Beispiel #2
0
        public override MotionMap Detect(int width, int height, int offset, int stride, byte[] bgr24bytes, DateTime timestamp)
        {
            short[,] map = new short[1, 1];
            map[0, 0]    = 1;
            short[] pixX = new short[] { 0 };
            short[] pixY = new short[] { 0 };

            List <MotionObject> mos = new List <MotionObject>();

            mos.Add(new MotionObject(pixX, pixY, (short)(width), (short)(height)));
            MotionMap mm = new MotionMap(map, mos);

            return(mm);
        }
Beispiel #3
0
    void Awake()
    {
        instance = this;

        sceneLayer   = LayerMask.GetMask(new string[] { "scene" });
        plateauLayer = LayerMask.GetMask(new string[] { "plateau" });

        zones   = FindObjectsOfType <MotionMapZone>();
        cursors = new List <MotionMapCursor>();

        clustersToAdd    = new List <Cluster>();
        clustersToRemove = new List <MotionMapCursor>();

        Debug.Log("Add cluster listeners");
        handler.clusterAdded   += clusterAdded;
        handler.clusterUpdated += clusterUpdated;
        handler.clusterRemoved += clusterRemoved;

        canvas = transform.Find("Canvas").gameObject;
        canvas.SetActive(false);
    }
Beispiel #4
0
        public override void Process(ImageData image, MotionMap motionMap, BackgroundImage background)
        {
            // здесь анализируется кадр. в качестве результата должно генерироваться событие.

            // добавляем к счетчику количество движущихся объектов (как бы считаем что любой движущийся объект = человек).
            if (motionMap != null)
            {
                currentCount += motionMap.MotionObjectsCount;
            }

            //генерирует событие не чаще раз в delay мс
            if (Environment.TickCount - lastTimeEventGen > delay)
            {
                CounterEvent ev = new CounterEvent(currentCount);

                ev.EventTime = image.Timestamp;

                GenerateEvent(ev, false);

                lastTimeEventGen = Environment.TickCount;
                // обнавляем счетчик людей.
                currentCount = 0;
            }
        }
Beispiel #5
0
        /// <summary>
        /// エクスプレッションを設定する
        /// </summary>
        /// <param name="AllocationId"></param>
        /// <param name="sentence"></param>
        public IEnumerator SetExpression(MsgSentence sentence)
        {
            int AllocationId = sentence.AllocationId;

            if (AllocationId < 0)
            {
                AllocationId = 0;
            }

            //モデルに感情をセットする
            yield return(TableModelId[sentence.AllocationId].ActiveModel.SetExpression(MotionMap.GetMotion(sentence.Emotion, sentence.Point)));
        }