Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        kinect            = devOrEmu.getKinect();
        players           = new Kinect.NuiSkeletonTrackingState[Kinect.Constants.NuiSkeletonCount];
        trackedPlayers    = new int[Kinect.Constants.NuiSkeletonMaxTracked];
        trackedPlayers[0] = -1;
        trackedPlayers[1] = -1;
        bonePos           = new Vector3[2, (int)Kinect.NuiSkeletonPositionIndex.Count];
        boneVel           = new Vector3[2, (int)Kinect.NuiSkeletonPositionIndex.Count];
        boneState         = new Kinect.NuiSkeletonPositionTrackingState[2, (int)Kinect.NuiSkeletonPositionIndex.Count];
        handState         = new bool[2, 2];

        //create the transform matrix that converts from kinect-space to world-space
        Matrix4x4 trans = new Matrix4x4();

        trans.SetTRS(new Vector3(-kinect.getKinectCenter().x,
                                 kinect.getSensorHeight() - kinect.getKinectCenter().y,
                                 -kinect.getKinectCenter().z),
                     Quaternion.identity, Vector3.one);
        Matrix4x4  rot         = new Matrix4x4();
        Quaternion quat        = new Quaternion();
        double     theta       = Mathf.Atan((kinect.getLookAt().y + kinect.getKinectCenter().y - kinect.getSensorHeight()) / (kinect.getLookAt().z + kinect.getKinectCenter().z));
        float      kinectAngle = (float)(theta * (180 / Mathf.PI));

        quat.eulerAngles = new Vector3(-kinectAngle, 0, 0);
        rot.SetTRS(Vector3.zero, quat, Vector3.one);
        Matrix4x4 flip = Matrix4x4.identity;

        flip[2, 2] = -1;
        //final transform matrix offsets the rotation of the kinect, then translates to a new center
        kinectToWorld = flip * trans * rot;
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        kinect = devOrEmu.getKinect();
        //allocate space to store the data of storedFrames frames.
        frameQueue = new Queue(storedFrames);
        for (int ii = 0; ii < storedFrames; ii++)
        {
            frameData frame = new frameData();
            frame.depthImg     = new short[320 * 240];
            frame.players      = new bool[Kinect.Constants.NuiSkeletonCount];
            frame.segmentation = new bool[Kinect.Constants.NuiSkeletonCount, 320 * 240];
            frame.bounds       = new int[Kinect.Constants.NuiSkeletonCount, 4];
            frameQueue.Enqueue(frame);
        }



        if (target == null)
        {
            target = renderer;
        }
        textureSize       = ResolutionData.FromZigResolution(TextureSize);
        texture           = new Texture2D(textureSize.Width, textureSize.Height);
        texture.wrapMode  = TextureWrapMode.Clamp;
        depthHistogramMap = new float[MaxDepth];
        depthToColor      = new Color32[MaxDepth];
        outputPixels      = new Color32[textureSize.Width * textureSize.Height];


        if (null != target)
        {
            target.material.mainTexture = texture;
        }
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     kinect = devOrEmu.getKinect();
     //tex = new Texture2D(640,480,TextureFormat.ARGB32,false);
     tex = new Texture2D(320, 240, TextureFormat.ARGB32, false);
     renderer.material.mainTexture = tex;
 }
Exemplo n.º 4
0
    //end lxjk


    // Use this for initialization
    void Start()
    {
        outputDir  = Application.dataPath + "/../YuYuYouEr_Kinect_Data/Recordings/";
        outputFile = outputDir + "playback";

        kinect = devOrEmu.getKinect();
    }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     kinect             = devOrEmu.getKinect();
     lastPlayerDetected = false;
     text.text          = "No Player Detected";
     text.color         = Color.red;
 }
Exemplo n.º 6
0
    // Use this for initialization

    void Start()
    {
        kinect   = devOrEmu.getKinect();
        sw       = new SkeletonWrapper();
        skeleton = GameObject.Find("SkeletonWrapper");
        StartCoroutine("WaveSegments");
    }
 // Use this for initialization
 void Start()
 {
     kinect = devOrEmu.getKinect();
     //tex = new Texture2D(640,480,TextureFormat.ARGB32,false);
     tex = new Texture2D(320, 240, TextureFormat.ARGB32, false);
     gameObject.GetComponent <Renderer>().material.mainTexture = tex;
 }
Exemplo n.º 8
0
 void Start()
 {
     sw = new SkeletonWrapper();
     openconnection();
     kinect = devOrEmu.getKinect();
     StartCoroutine("SetGuard");
     tex = new Texture2D(320, 240, TextureFormat.ARGB32, false);
     GetComponent <Renderer>().material.mainTexture = tex;
 }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        kinect       = devOrEmu.getKinect();
        video_width  = Kinect.NativeMethods.qfKinectGetVideoWidth();
        video_height = Kinect.NativeMethods.qfKinectGetVideoHeight();

        tex = new Texture2D(video_width, video_height, TextureFormat.ARGB32, false);
        GetComponent <Renderer>().material.mainTexture = tex;
    }
Exemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     GameObject obj = GameObject.Find ("KinectPrefab");
     devOrEmu = obj.GetComponent<DeviceOrEmulator> ();
     kinect = devOrEmu.getKinect();
     //tex = new Texture2D(640,480,TextureFormat.ARGB32,false);
     tex = new Texture2D(320,240,TextureFormat.ARGB32,false);
     GetComponent<Renderer>().material.mainTexture = tex;
 }
Exemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        devOrEmu = (DeviceOrEmulator) FindObjectOfType(typeof(DeviceOrEmulator));

        kinect = devOrEmu.getKinect();
        //tex = new Texture2D(640,480,TextureFormat.ARGB32,false);
        tex = new Texture2D(320,240,TextureFormat.ARGB32,false);
        renderer.material.mainTexture = tex;
    }
Exemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        kinect = devOrEmu.getKinect();
        //tex = new Texture2D(640,480,TextureFormat.ARGB32,false);
        tex = new Texture2D(320, 240, TextureFormat.ARGB32, false);
        GetComponent <Renderer>().material.mainTexture = tex;


        // Get a reference to the storage service, using the default Firebase App
        fbStorage = FirebaseStorage.DefaultInstance;
    }
Exemplo n.º 13
0
    // Use this for initialization
    void Start()
    {
        kinect = devOrEmu.getKinect();

        _bones = new GameObject[(int)Kinect.NuiSkeletonPositionIndex.Count] {
            Hip_Center, Spine, Shoulder_Center, Head,
            Shoulder_Left, Elbow_Left, Wrist_Left, Hand_Left,
            Shoulder_Right, Elbow_Right, Wrist_Right, Hand_Right,
            Hip_Left, Knee_Left, Ankle_Left, Foot_Left,
            Hip_Right, Knee_Right, Ankle_Right, Foot_Right
        };

        m_skl_InColorPoint = new Vector3[(int)Kinect.NuiSkeletonPositionIndex.Count];
    }
Exemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     kinect = devOrEmu.getKinect();
     //allocate space to store the data of storedFrames frames.
     frameQueue = new Queue(storedFrames);
     for (int ii = 0; ii < storedFrames; ii++)
     {
         frameData frame = new frameData();
         frame.depthImg     = new short[320 * 240];
         frame.players      = new bool[Kinect.Constants.NuiSkeletonCount];
         frame.segmentation = new bool[Kinect.Constants.NuiSkeletonCount, 320 * 240];
         frame.bounds       = new int[Kinect.Constants.NuiSkeletonCount, 4];
         frameQueue.Enqueue(frame);
     }
 }
Exemplo n.º 15
0
    // Use this for initialization
    void Start()
    {
        kinect = devOrEmu.getKinect();

        depth_width  = Kinect.NativeMethods.qfKinectGetDepthWidth();
        depth_height = Kinect.NativeMethods.qfKinectGetDepthHeight();

        //allocate space to store the data of storedFrames frames.
        frameQueue = new Queue(storedFrames);
        for (int ii = 0; ii < storedFrames; ii++)
        {
            frameData frame = new frameData();
            frame.depthImg     = new short[depth_width * depth_height];
            frame.players      = new bool[Kinect.Constants.NuiSkeletonCount];
            frame.segmentation = new bool[Kinect.Constants.NuiSkeletonCount, depth_width *depth_height];
            frame.bounds       = new int[Kinect.Constants.NuiSkeletonCount, 4];
            frameQueue.Enqueue(frame);
        }
    }
Exemplo n.º 16
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();
        }
    }
Exemplo n.º 17
0
    void Start()
    {
        devOrEmu = GameObject.Find("KinectPrefab(Clone)").GetComponent <DeviceOrEmulator>();
        PointCloudSlowDistance = 6.0f;
        kinect = devOrEmu.getKinect();
        //	tex = new Texture2D(640,480,TextureFormat.ARGB32,false);
        tex = new Texture2D(80, 60, TextureFormat.ARGB32, false);
//		tex = new Texture2D(160, 120,TextureFormat.ARGB32, false);
//		tex = new Texture2D(80, 60,TextureFormat.ARGB32, false);
//		renderer.material.mainTexture = tex;
        thePixels         = new GameObject[length, width];
        originalPositions = new GameObject[length, width];
        numPixels         = length * width;
        //int middlePointx = 0;
        //int middlePointy = 0;
        for (int i = 0; i < length; i++)
        {
            for (int x = 0; x < width; x++)
            {
                thePixels[i, x]                          = (GameObject)GameObject.Instantiate(pointCloudPixel, new Vector3((float)-i / 4, (float)-x / 4, 0), Quaternion.identity);
                originalPositions[i, x]                  = (GameObject)GameObject.Instantiate(positionHolder, new Vector3((float)-i / 4, (float)-x / 4, 0), Quaternion.identity);
                thePixels[i, x].transform.parent         = PointCloudParent.transform;
                originalPositions[i, x].transform.parent = PointCloudParent.transform;
                thePixels[i, x].renderer.material.color  = Color.white;

                //		if(x == width/2 && i == length/2)
                //		{
                //			middlePointx = x;
                //			middlePointy = i;
                //		}
                //Add Particle System?
            }
        }
        PointCloudParent.transform.Rotate(new Vector3(0, 0, 90));
        //middlePoint = thePixels[middlePointx, middlePointy].transform.position;
    }
Exemplo n.º 18
0
    void Start()
    {
        devOrEmu = GameObject.Find ("KinectPrefab(Clone)").GetComponent<DeviceOrEmulator>();
        PointCloudSlowDistance = 6.0f;
        kinect = devOrEmu.getKinect();
        //	tex = new Texture2D(640,480,TextureFormat.ARGB32,false);
        tex = new Texture2D(80,60,TextureFormat.ARGB32,false);
        //		tex = new Texture2D(160, 120,TextureFormat.ARGB32, false);
        //		tex = new Texture2D(80, 60,TextureFormat.ARGB32, false);
        //		renderer.material.mainTexture = tex;
        thePixels = new GameObject[length, width];
        originalPositions = new GameObject[length, width];
        numPixels = length * width;
        //int middlePointx = 0;
        //int middlePointy = 0;
        for(int i = 0; i < length; i++)
        {
            for(int x = 0; x < width; x++)
            {
                thePixels[i,x] = (GameObject)GameObject.Instantiate (pointCloudPixel, new Vector3((float)-i/4, (float)-x/4, 0), Quaternion.identity);
                originalPositions[i,x] = (GameObject)GameObject.Instantiate (positionHolder, new Vector3((float)-i/4, (float)-x/4, 0), Quaternion.identity);
                thePixels[i,x].transform.parent = PointCloudParent.transform;
                originalPositions[i,x].transform.parent = PointCloudParent.transform;
                thePixels[i,x].renderer.material.color = Color.white;

        //		if(x == width/2 && i == length/2)
        //		{
        //			middlePointx = x;
        //			middlePointy = i;
        //		}
                //Add Particle System?
            }
        }
        PointCloudParent.transform.Rotate (new Vector3(0,0,90));
        //middlePoint = thePixels[middlePointx, middlePointy].transform.position;
    }
Exemplo n.º 19
0
 public override void Start()
 {
     base.Start();
     Provider = DevOrEmu.getKinect();
 }
Exemplo n.º 20
0
    //end lxjk


    // Use this for initialization
    void Start()
    {
        kinect = devOrEmu.getKinect();
    }