Esempio n. 1
0
 /**
  * \if english
  * @brief Get the skeleton connections.
  * @param[out] outConnections The connections of skeleton.
  * \else
  * @brief 获取骨骼点之间的连接关系。
  * @param[out] outConnections 骨骼点之间的连接。
  * \endif
  */
 public void GetSkeletonConnection(List <KeyValuePair <SkeletonPointName, SkeletonPointName> > outConnections)
 {
     if (null == outConnections)
     {
         throw new ArgumentNullException();
     }
     outConnections.Clear();
     int[] connections  = m_ndkSession.HandAdapter.GetSkeletonConnection(m_trackableHandle);
     int[] skeletonType = m_ndkSession.HandAdapter.GetHandSkeletonType(m_trackableHandle);
     for (int i = 0; i < connections.Length / 2; i++)
     {
         if (connections[2 * i] < 0 || connections[2 * i] >= skeletonType.Length ||
             connections[2 * i + 1] < 0 || connections[2 * i + 1] >= skeletonType.Length)
         {
             continue;
         }
         if (!ValueLegalityChecker.CheckInt("GetSkeletonConnection", skeletonType[connections[2 * i]],
                                            AdapterConstants.Enum_HandSkeletonPointName_MinIntValue, AdapterConstants.Enum_HandSkeletonPointName_MaxIntValue - 1) ||
             !ValueLegalityChecker.CheckInt("GetSkeletonConnection", skeletonType[connections[2 * i + 1]],
                                            AdapterConstants.Enum_HandSkeletonPointName_MinIntValue, AdapterConstants.Enum_HandSkeletonPointName_MaxIntValue - 1))
         {
             continue;
         }
         outConnections.Add(new KeyValuePair <SkeletonPointName, SkeletonPointName>(
                                (SkeletonPointName)skeletonType[connections[2 * i]],
                                (SkeletonPointName)skeletonType[connections[2 * i + 1]]));
     }
 }
Esempio n. 2
0
        /**
         * \if english
         * @brief Get the skeletons of this Body.
         * @param[out] outDic The Dictionary of the body skeletons. The item in \c outDic is indexed by
         * \link SkeletonPointName \endlink and the second value of this item is a \link SkeletonPointEntry \endlink.
         * \else
         * @brief 获取当前body对象的骨骼点。
         * @param[out] outDic 当前骨骼点的字典。outDic的项是通过\link SkeletonPointName \endlink索引,索引的对象是
         * \link SkeletonPointEntry \endlink。
         * \endif
         */
        public void GetSkeletons(Dictionary <SkeletonPointName, SkeletonPointEntry> outDic)
        {
            if (null == outDic)
            {
                throw new ArgumentNullException();
            }
            outDic.Clear();

            bool[]    is2DValid    = m_ndkSession.BodyAdapter.GetSkeletonPointIsExist_2D(m_trackableHandle);
            Vector3[] coord2D      = m_ndkSession.BodyAdapter.GetSkeletonPoint2D(m_trackableHandle);
            bool[]    is3DValid    = m_ndkSession.BodyAdapter.GetSkeletonPointIsExist_3D(m_trackableHandle);
            Vector3[] coord3D      = m_ndkSession.BodyAdapter.GetSkeletonPoint3D(m_trackableHandle);
            int[]     skeletonType = m_ndkSession.BodyAdapter.GetSkeletonType(m_trackableHandle);
            float[]   confidence   = m_ndkSession.BodyAdapter.GetSkeletonConfidence(m_trackableHandle);
            int       sCnt         = GetSkeletonPointCount();

            for (int i = 0; i < sCnt; i++)
            {
                SkeletonPointEntry spe = new SkeletonPointEntry(is2DValid[i], coord2D[i],
                                                                is3DValid[i], coord3D[i], confidence[i]);
                if (!ValueLegalityChecker.CheckInt("GetSkeletons", skeletonType[i],
                                                   0, (int)SkeletonPointName.SKELETON_LENGTH - 1))
                {
                    continue;
                }
                outDic.Add((SkeletonPointName)skeletonType[i], spe);
            }
        }
Esempio n. 3
0
        /**
         * \if english
         * @brief Get the skeletons.
         *
         * The out skeleton data is under the coordinate of \link GetSkeletonCoordinateSystemType()\endlink. Currently,
         * this method should only be called when \link ARHandTrackingConfig.CameraLensFacing \endlink is set FRONT and
         * \link ARHandTrackingConfig.EnableDepth \endlink is set true.
         * @param[out] outSkeleton The dictionary of skeletons.
         * \else
         * @brief 获取骨骼点。
         *
         * 输出的骨骼点位于\link GetSkeletonCoordinateSystemType()\endlink的坐标系下。目前,仅当
         * \link ARHandTrackingConfig.CameraLensFacing \endlink 为前置,\link ARHandTrackingConfig.EnableDepth \endlink为
         * true时,该方法才返回有效数据。
         * @param[out] outSkeleton 骨骼点的字典。
         * \endif
         */
        public void GetSkeletons(Dictionary <SkeletonPointName, SkeletonPointEntry> outSkeleton)
        {
            if (null == outSkeleton)
            {
                throw new ArgumentNullException();
            }
            outSkeleton.Clear();

            int[] skeletonType = m_ndkSession.HandAdapter.GetHandSkeletonType(m_trackableHandle);

            Vector3[] points = m_ndkSession.HandAdapter.GetHandSkeletonData(m_trackableHandle);
            for (int i = 0; i < skeletonType.Length; i++)
            {
                if (!ValueLegalityChecker.CheckInt("GetSkeletons", skeletonType[i], 0,
                                                   (int)SkeletonPointName.SKELETON_LENGTH - 1))
                {
                    continue;
                }
                outSkeleton.Add((SkeletonPointName)skeletonType[i], new SkeletonPointEntry(points[i]));
            }
        }
Esempio n. 4
0
        public void GetSkeletonConnection(List <KeyValuePair <SkeletonPointName, SkeletonPointName> > outConnections)
        {
            if (null == outConnections)
            {
                throw new ArgumentNullException();
            }
            outConnections.Clear();
            Vector2Int[] connections = m_ndkSession.HandAdapter.GetSkeletonConnection(m_trackableHandle);

            for (int i = 0; i < connections.Length; i++)
            {
                if (!ValueLegalityChecker.CheckInt("GetSkeletonConnection", connections[i].x, 0,
                                                   (int)SkeletonPointName.SKELETON_LENGTH - 1) ||
                    !ValueLegalityChecker.CheckInt("GetSkeletonConnection", connections[i].y, 0,
                                                   (int)SkeletonPointName.SKELETON_LENGTH - 1))
                {
                    continue;
                }
                outConnections.Add(new KeyValuePair <SkeletonPointName, SkeletonPointName>(
                                       (SkeletonPointName)connections[i].x, (SkeletonPointName)connections[i].y));
            }
        }