Ejemplo n.º 1
0
 public void TakeSnapshot()
 {
     if (kinect.pollColor())
     {
         tex.SetPixels32(mipmapImg(kinect.getColor(), 640, 480));
         tex.Apply(false);
     }
 }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (kinect.pollColor())
     {
         //tex.SetPixels32(kinect.getColor());
         tex.SetPixels32(mipmapImg(kinect.getColor(), 640, 480));
         tex.Apply(false);
     }
 }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (kinect.pollColor())
     {
         usersClrTex.SetPixels32(kinect.getColor());
         usersClrTex.Apply();
     }
 }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (kinect.pollColor())
        {
            //tex.SetPixels32(kinect.getColor());

            /*if (Player != null && Player.Replaying)
             * {
             *      tex.SetPixels32(mipmapImg(Player.GetCurrentFrame().Colors, 640, 480));
             * }
             * else*/
            {
                tex.SetPixels32(mipmapImg(kinect.getColor(), 640, 480));
            }
            tex.Apply(false);
        }
    }
Ejemplo n.º 5
0
//	private Color32[] mipmapImg(Color32[] src, int width, int height)
//			{
//				int newWidth = width / 2;
//				int newHeight = height / 2;
//		//		int newWidth = 80;
//		//		int newHeight = 60;
//				Color32[] dst = new Color32[newWidth * newHeight];
//				for(int yy = 0; yy < newHeight; yy++)
//				{
//					for(int xx = 0; xx < newWidth; xx++)
//					{
//						int TLidx = (xx * 2) + yy * 2 * width;
//						int TRidx = (xx * 2 + 1) + yy * width * 2;
//						int BLidx = (xx * 2) + (yy * 2 + 1) * width;
//						int BRidx = (xx * 2 + 1) + (yy * 2 + 1) * width;
//
//
//
//		//				int TLidx = (xx * 2) + yy * 2 * width;
//		//				int TRidx = (xx * 2 + 1) + yy * width * 2;
//		//				int BLidx = (xx * 2) + (yy * 2 + 1) * width;
//		//				int BRidx = (xx * 2 + 1) + (yy * 2 + 1) * width;
//						dst[xx + yy * newWidth] = Color32.Lerp(Color32.Lerp(src[BLidx],src[BRidx],.5f),
//						                                       Color32.Lerp(src[TLidx],src[TRidx],.5F),.5F);
//						thePixels[xx, yy].renderer.material.color = dst[xx + yy * newWidth];
//
//
//				//		thePixels[xx,yy].renderer.material.color = Color32.Lerp (Color32.Lerp (src[BLidx],src[BRidx],.5F),
//				//		                                                         Color32.Lerp(src[TLidx],src[TRidx],.5F),.5F);
//					}
//				}
//				return dst;
//			}



    public Texture2D GetCurrentTexture()
    {
        Texture2D t = new Texture2D(320, 240, TextureFormat.ARGB32, false);

        t.SetPixels32(mipmapImg(kinect.getColor(), 640, 480));
        t.Apply(false);
        return(t);
    }
Ejemplo n.º 6
0
 // Update is called once per frame
 void Update()
 {
     if (kinect.pollColor())
     {
         //tex.SetPixels32(KinectSensor.Instance.colorImage);
         tex.SetPixels32(mipmapImg(kinect.getColor(), 640, 480));
         tex.Apply(false);
     }
 }
Ejemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        if (kinect.pollColor())
        {
            //tex.SetPixels32(kinect.getColor());

            /*streaming image to server */

            /*
             * if (countFrameCapture == 0)
             * {
             *  writePicture(mipmapImg(kinect.getColor(), 640, 480));
             * }
             * countFrameCapture = (countFrameCapture + 1) % SKIP_FRAMES_CAPTURE;
             */
            tex.SetPixels32(mipmapImg(kinect.getColor(), 640, 480));

            tex.Apply(false);
        }
    }
Ejemplo n.º 8
0
 // Update is called once per frame
 void Update()
 {
     if (kinect.pollColor())
     {
         Color32[] c = kinect.getColor();
         if (null != c)
         {
             tex.SetPixels32(c);
             tex.Apply(false);
         }
     }
 }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        kinect = devOrEmu.getKinect();
        if (kinect.pollColor() == true)
        {
            Color32[] colorKinect = kinect.getColor();

            for (int i = 0; i < 640; i++)
            {
                for (int j = 0; j < 480; j++)
                {
                    int index = i * 480 + j;
                    int a     = colorKinect[index].a;
                    int r     = colorKinect[index].r;
                    int g     = colorKinect[index].g;
                    int b     = colorKinect[index].b;
                    bitmapTest.SetPixel(i, j, System.Drawing.Color.FromArgb(a, r, g, b));
                }
            }

            image = UnmanagedImage.FromManagedImage(bitmapTest);
            //var bitmap = image.ToManagedImage();

            if (image.PixelFormat == System.Drawing.Imaging.PixelFormat.Format8bppIndexed)
            {
                grayImage = image;
            }
            else
            {
                if (grayImage != null)
                {
                    grayImage.Dispose();
                }
                grayImage = UnmanagedImage.Create(image.Width, image.Height,
                                                  System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
                Grayscale.CommonAlgorithms.BT709.Apply(image, grayImage);
            }
            scan_code();
        }
    }