当前位置: 首页>>代码示例>>C#>>正文


C# KinectManager.IsInitialized方法代码示例

本文整理汇总了C#中KinectManager.IsInitialized方法的典型用法代码示例。如果您正苦于以下问题:C# KinectManager.IsInitialized方法的具体用法?C# KinectManager.IsInitialized怎么用?C# KinectManager.IsInitialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KinectManager的用法示例。


在下文中一共展示了KinectManager.IsInitialized方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SencerInitialize

    // Use this for initialization
    public void SencerInitialize()
    {
        // キネクトマネージャーの取得
        manager = KinectManager.Instance;

        if (manager && manager.IsInitialized ()) {
            KinectInterop.SensorData sensorData = manager.GetSensorData ();

            if (sensorData != null && sensorData.sensorInterface != null) {
                // get depth image size
                depthImageWidth = sensorData.depthImageWidth;
                depthImageHeight = sensorData.depthImageHeight;

                // calculate the foreground rectangles
                Rect cameraRect = Camera.main.pixelRect;
                float rectHeight = cameraRect.height;
                float rectWidth = cameraRect.width;

                if (rectWidth > rectHeight)
                    rectWidth = rectHeight * depthImageWidth / depthImageHeight;
                else
                    rectHeight = rectWidth * depthImageHeight / depthImageWidth;

                float foregroundOfsX = (cameraRect.width - rectWidth) / 2;
                float foregroundOfsY = (cameraRect.height - rectHeight) / 2;
                foregroundImgRect = new Rect (foregroundOfsX, foregroundOfsY, rectWidth, rectHeight);
                foregroundGuiRect = new Rect (foregroundOfsX, cameraRect.height - foregroundOfsY, rectWidth, -rectHeight);
            }
        }
    }
开发者ID:AkihiroSato0309,项目名称:SoundRiderMiku_kinect,代码行数:31,代码来源:KinectSenserInitializer.cs

示例2: Start

	void Start () 
	{
		manager = KinectManager.Instance;

		if(manager && manager.IsInitialized())
		{
			KinectInterop.SensorData sensorData = manager.GetSensorData();

			if(sensorData != null && sensorData.sensorInterface != null && foregroundCamera != null)
			{
				// get depth image size
				depthImageWidth = sensorData.depthImageWidth;
				depthImageHeight = sensorData.depthImageHeight;

				// calculate the foreground rectangles
				Rect cameraRect = foregroundCamera.pixelRect;
				float rectHeight = cameraRect.height;
				float rectWidth = cameraRect.width;
				
				if(rectWidth > rectHeight)
					rectWidth = rectHeight * depthImageWidth / depthImageHeight;
				else
					rectHeight = rectWidth * depthImageHeight / depthImageWidth;
				
				float foregroundOfsX = (cameraRect.width - rectWidth) / 2;
				float foregroundOfsY = (cameraRect.height - rectHeight) / 2;
				foregroundImgRect = new Rect(foregroundOfsX, foregroundOfsY, rectWidth, rectHeight);
				foregroundGuiRect = new Rect(foregroundOfsX, cameraRect.height - foregroundOfsY, rectWidth, -rectHeight);
				
				// create joint colliders
				numColliders = sensorData.jointCount;
				jointColliders = new GameObject[numColliders];
				
				for(int i = 0; i < numColliders; i++)
				{
					string sColObjectName = ((KinectInterop.JointType)i).ToString() + "Collider";
					jointColliders[i] = new GameObject(sColObjectName);
					jointColliders[i].transform.parent = transform;
					
					SphereCollider collider = jointColliders[i].AddComponent<SphereCollider>();
					collider.radius = 0.2f;
				}
			}
		}

	}
开发者ID:anteaterho,项目名称:SpoutTestTemp,代码行数:46,代码来源:DepthImageViewer.cs

示例3: Start

	void Start () 
	{
		manager = KinectManager.Instance;

		if(manager && manager.IsInitialized())
		{
			Rect cameraRect = Camera.main.pixelRect;
			float rectHeight = cameraRect.height;
			float rectWidth = cameraRect.width;

			KinectInterop.SensorData sensorData = manager.GetSensorData();

			if(sensorData != null && sensorData.sensorInterface != null)
			{
				if(rectWidth > rectHeight)
					rectWidth = rectHeight * sensorData.depthImageWidth / sensorData.depthImageHeight;
				else
					rectHeight = rectWidth * sensorData.depthImageHeight / sensorData.depthImageWidth;
				
				foregroundRect = new Rect((cameraRect.width - rectWidth) / 2, cameraRect.height - (cameraRect.height - rectHeight) / 2, rectWidth, -rectHeight);
			}
		}
	}
开发者ID:EmMoi,项目名称:VELocomotion,代码行数:23,代码来源:SimpleBackgroundRemoval.cs

示例4: Update

	void Update () 
	{
		// get reference to the Kinect2Interface
		if(k2interface == null)
		{
			manager = KinectManager.Instance;
			
			if(manager && manager.IsInitialized())
			{
				KinectInterop.SensorData sensorData = manager.GetSensorData();
				
				if(sensorData != null && sensorData.sensorInterface != null)
				{
					k2interface = (Kinect2Interface)sensorData.sensorInterface;
				}
			}
		}

		// get the face points
		if(k2interface != null && k2interface.faceFrameResults != null)
		{
			if(manager != null && manager.IsUserDetected())
			{
				ulong userId = (ulong)manager.GetPrimaryUserID();
				
				for(int i = 0; i < k2interface.faceFrameResults.Length; i++)
				{
					if(k2interface.faceFrameResults[i] != null && k2interface.faceFrameResults[i].TrackingId == userId)
					{
						facePoints = k2interface.faceFrameResults[i].FacePointsInColorSpace;
						break;
					}
				}
			}
		}

	}
开发者ID:EmMoi,项目名称:VELocomotion,代码行数:37,代码来源:GetFacePointsDemo.cs

示例5: Update

    void Update()
    {
        // get reference to the Kinect2Interface
        if(k2interface == null)
        {
            manager = KinectManager.Instance;

            if(manager && manager.IsInitialized())
            {
                KinectInterop.SensorData sensorData = manager.GetSensorData();

                if(sensorData != null && sensorData.sensorInterface != null)
                {
                    k2interface = (Kinect2Interface)sensorData.sensorInterface;
                }
            }
        }

        // get the face points
        if(k2interface != null && k2interface.faceFrameResults != null)
        {
            if(manager != null && manager.IsUserDetected())
            {
                ulong userId = (ulong)manager.GetPrimaryUserID();

                for(int i = 0; i < k2interface.faceFrameResults.Length; i++)
                {
                    if(k2interface.faceFrameResults[i] != null && k2interface.faceFrameResults[i].TrackingId == userId)
                    {
                        facePoints = k2interface.faceFrameResults[i].FacePointsInColorSpace;
                        break;
                    }
                }
            }
        }

        if(manager && manager.IsInitialized() && k2interface != null)
        {
            long userId = manager.GetPrimaryUserID();

            if(manager.IsJointTracked(userId, (int)KinectInterop.JointType.Head))
            {
                //Vector3 headPos = manager.GetJointPosition(userId, (int)KinectInterop.JointType.Head);
                string sStatus = string.Empty;  // string.Format("Head: {0}\n", headPos);

                Vector2 facePointColor = GetFacePoint(facePoint);
                if(facePointColor != Vector2.zero && !float.IsInfinity(facePointColor.x) && !float.IsInfinity(facePointColor.y))
                {
                    Vector2 facePointDepth = manager.MapColorPointToDepthCoords(facePointColor, true);

                    if(facePointDepth != Vector2.zero && !float.IsInfinity(facePointDepth.x) && !float.IsInfinity(facePointDepth.y))
                    {
                        ushort depthValue = manager.GetDepthForPixel((int)facePointDepth.x, (int)facePointDepth.y);
                        Vector3 facePointPos = manager.MapDepthPointToSpaceCoords(facePointDepth, depthValue, true);

                        facePointTransform.position = facePointPos;
                        sStatus += string.Format("{0}: {1}", facePoint, facePointPos);
                    }
                }

                if(faceInfoText)
                {
                    faceInfoText.text = sStatus;
                }
            }
        }
    }
开发者ID:drfuzzyness,项目名称:WearHax-OlivMatt,代码行数:67,代码来源:GetFacePointsDemo.cs


注:本文中的KinectManager.IsInitialized方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。