public void UpdateZigInformation(ZigInput input)
 {
     foreach (ZigTrackedUser user in input.TrackedUsers.Values)
     {
         UpdateUser(user);
     }
 }
 ZigTrackedUser LookForTrackedUserInRegion(ZigInput zig, Bounds region) {
     foreach (ZigTrackedUser trackedUser in zig.TrackedUsers.Values) {
         if (trackedUser.SkeletonTracked && region.Contains(trackedUser.Position) && trackedUser != leftTrackedUser && trackedUser != rightTrackedUser) {
             return trackedUser;
         }
     }
     return null;
 }
 void Zig_Update(ZigInput zig) {
     if (SkeletonTracked && null == engagedTrackedUser) {
         foreach (ZigTrackedUser trackedUser in zig.TrackedUsers.Values) {
             if (trackedUser.SkeletonTracked) {
                 EngageUser(trackedUser);
             }
         }
     }
 }
Beispiel #4
0
	void Zig_Update(ZigInput zig) {
		runTime = false;
		if (zig.TrackedUsers.Count > 0) {
			foreach (ZigTrackedUser u in zig.TrackedUsers.Values) {
				if (u.SkeletonTracked) {
					runTime = true;
				}
			}
		}
	}
 void Zig_Update(ZigInput zig)
 {
     if (SkeletonTracked && null == engagedTrackedUser)
     {
         foreach (ZigTrackedUser trackedUser in zig.TrackedUsers.Values)
         {
             if (trackedUser.SkeletonTracked)
             {
                 EngageUser(trackedUser);
             }
         }
     }
 }
    void LateUpdate()
    {
        int x = 0;
        int y = 0;

        short[] rawDepthhMap = ZigInput.Depth.data;
        short[] rawLabelMap  = ZigInput.LabelMap.data;
        for (int i = cycle * emitterCount; i < (cycle + 1) * emitterCount; i++)
        {
            particleEmitters[i].ClearParticles();
            for (int particleIndex = 0; particleIndex < MAX_PARTICLES_PER_PE; particleIndex++)
            {
                if (y >= YScaled)
                {
                    break;
                }
                Vector3 scale = transform.localScale;
                int     index = x * factorX + XRes * factorY * y;
                Vector3 vec   = new Vector3(x * factorX, y * factorY, rawDepthhMap[index]);
                vec = worldSpace ? ZigInput.ConvertImageToWorldSpace(vec) : vec;
                vec = Vector3.Scale(vec, scale);

                if (onlyUsers)
                {
                    if (rawLabelMap[index] != 0)
                    {
                        particleEmitters[i].Emit(transform.rotation * vec + transform.position, velocity, size, energy, color);
                    }
                }
                else
                {
                    particleEmitters[i].Emit(transform.rotation * vec + transform.position, velocity, size, energy, color);
                }
                x = (x + 1) % XScaled;
                y = (x == 0) ? y + 1 : y;
            }

            if (y >= YScaled)
            {
                break;
            }
        }
        cycle = (cycle + 1) % cycles;
    }
Beispiel #7
0
 void Zig_Update(ZigInput input)
 {
     if (UseHistogram)
     {
         UpdateHistogram(ZigInput.Depth);
     }
     else
     {
         //TODO: don't repeat this every frame
         depthToColor[0] = Color.black;
         for (int i = 1; i < MaxDepth; i++)
         {
             float intensity = 1.0f - (i / (float)MaxDepth);
             //depthHistogramMap[i] = intensity * 255;
             depthToColor[i].r = (byte)(BaseColor.r * intensity);
             depthToColor[i].g = (byte)(BaseColor.g * intensity);
             depthToColor[i].b = (byte)(BaseColor.b * intensity);
             depthToColor[i].a = 255;//(byte)(BaseColor.a * intensity);
         }
     }
     UpdateTexture(ZigInput.Depth);
 }
 void Zig_Update(ZigInput zig) {
     bool areTheyEngaged = AllUsersEngaged;
     // left user
     if (null == leftTrackedUser) {
         leftTrackedUser = LookForTrackedUserInRegion(zig, leftRegion);
         if (null != leftTrackedUser) {
             leftTrackedUser.AddListener(LeftPlayer);
             SendMessage("UserEngagedLeft", this, SendMessageOptions.DontRequireReceiver);
         }
     }
     // right user
     if (null == rightTrackedUser) {
         rightTrackedUser = LookForTrackedUserInRegion(zig, rightRegion);
         if (null != rightTrackedUser) {
             rightTrackedUser.AddListener(RightPlayer);
             SendMessage("UserEngagedRight", this, SendMessageOptions.DontRequireReceiver);
         }
     }
     if (!areTheyEngaged && AllUsersEngaged) {
         SendMessage("AllUsersEngaged", this, SendMessageOptions.DontRequireReceiver);
     }
 }
Beispiel #9
0
    internal void CalculateNormal(C5.IPriorityQueue <CloudPoint> neighbors)
    {
        Vector avg = neighbors.Aggregate(new Vector(3), (sum, val) => sum + val.location) / (double)neighbors.Count;

        Matrix cov = ((double)1 / neighbors.Count) *
                     neighbors.Aggregate(new Matrix(3, 3),
                                         (sum, val) => sum +
                                         (val.location - avg).ToColumnMatrix() *
                                         (val.location - avg).ToRowMatrix());

        // that dude says the smallest eigenvalue is the normal
        // first column of eigenvectors is the smallest eigenvalued one
        normal = cov.EigenVectors.GetColumnVector(0);

        // orient normal toward viewpoint

        // to do this we have to push the origin into the world frame
        //v = ZigInput.ConvertImageToWorldSpace(v);
        var viewp = ZigInput.ConvertImageToWorldSpace(Vector3.zero);

        normal = ((normal * (viewp.ToVector() - this.location)) > 0 ? normal : -normal);
        normal.Normalize();
    }
 private void Zig_Update(ZigInput input)
 {
     if (!enabled) return;
     updateTexture(ZigInput.Depth);
 }
 void Zig_Update(ZigInput input)
 {
     if (UseHistogram) {
         UpdateHistogram(ZigInput.Depth);
     }
     else {
         //TODO: don't repeat this every frame
         depthToColor[0] = Color.black;
         for (int i = 1; i < MaxDepth; i++) {
             float intensity = 1.0f - (i/(float)MaxDepth);
             //depthHistogramMap[i] = intensity * 255;
             depthToColor[i].r = (byte)(BaseColor.r * intensity);
             depthToColor[i].g = (byte)(BaseColor.g * intensity);
             depthToColor[i].b = (byte)(BaseColor.b * intensity);
             depthToColor[i].a = 255;//(byte)(BaseColor.a * intensity);
         }
     }
     UpdateTexture(ZigInput.Depth);
 }
Beispiel #12
0
 void Zig_Update(ZigInput zig)
 {
     notifyListeners ("Zig_Update", zig);
 }
Beispiel #13
0
 void Zig_Update(ZigInput input)
 {
     UpdateTexture(ZigInput.Image);
 }
 void Zig_Update(ZigInput input)
 {
     UpdateHistogram(ZigInput.Depth);
     UpdateTexture(ZigInput.Depth);
 }
 void Zig_Update(ZigInput input)
 {
     UpdateHistogram(ZigInput.Depth);
     UpdateTexture(ZigInput.Depth);
 }
Beispiel #16
0
 void Zig_Update(ZigInput zig)
 {
     notifyListeners("Zig_Update", zig);
 }
    public PointCloud(short[] depth, int dWidth, int dHeight,
                      Color32[] color, int cWidth, int cHeight)
    {
        PointList = new List <CloudPoint>();

        // these are different sizes. use the depth image as the native index
        // we want to get as much depth data as possible
        this.rawColor = color;
        this.rawDepth = depth;

        this.depthX = dWidth;
        this.depthY = dHeight;
        this.colorX = cWidth;
        this.colorY = cHeight;

        // express scaling factors to take x,y positions in depth to color
        // also we are assuming that the color image is larger than the depth one
        int factorX = cWidth / dWidth;
        int factorY = cHeight / dHeight;

        for (int i = 0; i < depth.Length; i++)
        {
            // the transform that the Zig thing provides expects coordinates in the image plane though
            if ((depth[i] == 0) || (depth[i] == -1))
            {
                continue; // this is a garbage point
            }
            int x = (i % dWidth) * factorX;
            int y = (i / dWidth) * factorY;
            int z = depth[i];

            Vector3 v = new Vector3(x, y, z);
            v = ZigInput.ConvertImageToWorldSpace(v);

            int cIndex = x + y * cWidth;

            PointList.Add(new CloudPoint(v.ToVector(), color[cIndex], Vector.Zeros(3)));
        }

        depthHistogramMap = new float[MaxDepth];
        depthToColor      = new Color32[MaxDepth];
        colorizedDepth    = new Color32[depthX * depthY];


        UpdateHistogram();

        this.R = Matrix.Create(new double[, ] {
            { 1, 0, 0 },
            { 0, 1, 0 },
            { 0, 0, 1 }
        });                       // identity rotation

        this.T = Vector.Zeros(3); // zero translation



        //Transform = new Matrix(new double[,]{{1, 0, 0, 0},
        //                                     {0, 1, 0, 0},
        //                                     {0, 0, 1, 0},
        //                                     {0, 0, 0, 1}}); // homogeneous identity
    }
Beispiel #18
0
 void Zig_Update(ZigInput input)
 {
     UpdateTexture(ZigInput.Image);
 }
Beispiel #19
0
 void Zig_Update(ZigInput input)
 {
     UpdateTexture(ZigInput.LabelMap);
 }
Beispiel #20
0
 void Zig_Update(ZigInput input)
 {
     UpdateTexture(ZigInput.LabelMap);
 }
Beispiel #21
0
 public void Zig_UpdateInput(ZigInput aInput)
 {
     ManagerManager.Manager.mZigManager.DepthView.Zig_Update(ZgInput);
 }
Beispiel #22
0
 void Zig_Update(ZigInput zig)
 {
     FunctionsController.Instance.UpdateZigInformation(zig);
 }
Beispiel #23
0
 void Zig_Update(ZigInput zig)
 {
 }