void GetNoTrackingTexture(KinectOneDepth depth)
 {
     ushort[] data = depth.GetData();
     Debug.Log(outputPixels.Length);
     for (int i = 0; i < outputPixels.Length; i++)
     {
         int depthValue = Mathf.Clamp(data[i], 0, depthToColor.Length - 1);
         outputPixels[i] = depthToColor[depthValue];
     }
 }
 void GetNoTrackingTexture(KinectOneDepth depth)
 {
     ushort[] data = depth.GetData();
     Debug.Log(outputPixels.Length);
     for (int i = 0; i < outputPixels.Length; i++)
     {
         int depthValue = Mathf.Clamp(data[i], 0, depthToColor.Length - 1);
         outputPixels[i] = depthToColor[depthValue];
     }
 }
    void UpdateTexture(KinectOneDepth depth, KinectOneLabelMap labelmap, KinectOneImage image)
    {
        int trackedUserId = -1;

        if (m_engageuser != null && m_engageuser.engagedTrackedUser != null)
        {
            trackedUserId = m_engageuser.engagedTrackedUser.Id;
        }
        if (trackedUserId == -1)
        {
            GetNoTrackingTexture(depth);
        }
        else
        {
            Kinect.ColorSpacePoint[] colorSpacePoints = new Kinect.ColorSpacePoint[depth.xres * depth.yres];
            _mapper.MapDepthFrameToColorSpace(depth.GetData(), colorSpacePoints);
            GetRemoveBackground(labelmap, image, colorSpacePoints);
        }
        texture.SetPixels32(outputPixels);
        texture.Apply();
    }
 void UpdateTexture(KinectOneDepth depth, KinectOneLabelMap labelmap, KinectOneImage image)
 {
     int trackedUserId = -1;
     if (m_engageuser != null && m_engageuser.engagedTrackedUser != null)
         trackedUserId = m_engageuser.engagedTrackedUser.Id;
     if (trackedUserId == -1)
     {
         GetNoTrackingTexture(depth);
     }
     else
     {
         Kinect.ColorSpacePoint[] colorSpacePoints = new Kinect.ColorSpacePoint[depth.xres * depth.yres];
         _mapper.MapDepthFrameToColorSpace(depth.GetData(), colorSpacePoints);
         GetRemoveBackground(labelmap, image, colorSpacePoints);
     }
     texture.SetPixels32(outputPixels);
     texture.Apply();
 }