Exemple #1
0
    void Start()
    {
        leftHandCube  = GameObject.CreatePrimitive(PrimitiveType.Cube);
        rightHandCube = GameObject.CreatePrimitive(PrimitiveType.Cube);

        sensor         = Kinect.KinectSensor.GetDefault();
        mapper         = sensor.CoordinateMapper;
        depthFrameInfo = sensor.DepthFrameSource.FrameDescription;
        depthImg       = new Texture2D(depthFrameInfo.Width, depthFrameInfo.Height, TextureFormat.RGB24, false);
    }
    void Start()
    {
        // Get the description of the depth frames.
        depthFrameDesc = KinectSensor.GetDefault().DepthFrameSource.FrameDescription;

        // get reference to DepthSourceManager (which is included in the distributed 'Kinect for Windows v2 Unity Plugin zip')
        depthSourceManagerScript = depthSourceManager.GetComponent<DepthSourceManager> ();

        // allocate.
        depthBitmapBuffer = new byte[depthFrameDesc.LengthInPixels * 3];
        texture = new Texture2D(depthFrameDesc.Width, depthFrameDesc.Height, TextureFormat.RGB24, false);

        // arrange size of gameObject to be drawn
        gameObject.transform.localScale = new Vector3 (scale * depthFrameDesc.Width / depthFrameDesc.Height, scale, 1.0f);
    }
    // Use this for initialization
    void Start()
    {
        _Sensor = KinectSensor.GetDefault();

        if (_Sensor != null)
        {
            _Reader = _Sensor.BodyIndexFrameSource.OpenReader();

            bodyIndexFrameDescription = _Sensor.BodyIndexFrameSource.FrameDescription;

            if (!_Sensor.IsOpen)
            {
                _Sensor.Open();
            }
        }
    }
 void Start()
 {
     depthFrameDesc = KinectSensor.GetDefault().DepthFrameSource.FrameDescription;
     depthWidth = depthFrameDesc.Width;
     depthHeight = depthFrameDesc.Height;
     // buffer for points mapped to camera space coordinate.
     mapper = KinectSensor.GetDefault().CoordinateMapper;
     cameraSpacePoints = new CameraSpacePoint[depthWidth * depthHeight];
     depthSourceManagerScript = depthSourceManager.GetComponent<DepthSourceManager>();
     colorSourceManagerScript = colorSourceManager.GetComponent<ColorSourceManager>();
     particles = new ParticleSystem.Particle[depthWidth * depthHeight];
     color_reader = KinectSensor.GetDefault().ColorFrameSource.OpenReader();
     colorFrameDesc = KinectSensor.GetDefault().ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba);
     colorSpacePoints = new ColorSpacePoint[depthWidth * depthHeight];
     color_array = new byte[colorFrameDesc.BytesPerPixel * colorFrameDesc.LengthInPixels];
 }
    void Start()
    {
        // Get the description of the depth frames.
        depthFrameDesc = KinectSensor.GetDefault().DepthFrameSource.FrameDescription;
        depthWidth = depthFrameDesc.Width;
        depthHeight = depthFrameDesc.Height;

        // buffer for points mapped to camera space coordinate.
        cameraSpacePoints = new CameraSpacePoint[depthWidth * depthHeight];
        mapper = KinectSensor.GetDefault ().CoordinateMapper;

        // get reference to DepthSourceManager (which is included in the distributed 'Kinect for Windows v2 Unity Plugin zip')
        depthSourceManagerScript = depthSourceManager.GetComponent<DepthSourceManager> ();

        // particles to be drawn
        particles = new ParticleSystem.Particle[depthWidth * depthHeight];
    }
    // Use this for initialization
    void Start()
    {
        // Get the description of the depth frames.
        infraredFrameDesc = KinectSensor.GetDefault().InfraredFrameSource.FrameDescription;
        depthFrameDesc = KinectSensor.GetDefault().DepthFrameSource.FrameDescription;
        depthWidth = depthFrameDesc.Width;
        depthHeight = depthFrameDesc.Height;

        // buffer for points mapped to camera space coordinate.
        cameraSpacePoints = new CameraSpacePoint[depthWidth * depthHeight];
        mapper = KinectSensor.GetDefault().CoordinateMapper;

        // get reference to infraredSourceManager (which is included in the distributed 'Kinect for Windows v2 Unity Plugin zip')
        multiSourceManagerScript = multiSourceManager.GetComponent<MultiSourceManager>();
        infraredSourceManagerScript = infraredSourceManager.GetComponent<InfraredSourceManager>();

        //最初はてきとーな場所に配置
        transform.position = new Vector3(0.0f, 10.0f, 10.0f);
    }
Exemple #7
0
 // Token: 0x06002C92 RID: 11410 RVA: 0x000DDCB2 File Offset: 0x000DC0B2
 internal FrameDescription(IntPtr pNative)
 {
     this._pNative = pNative;
     FrameDescription.Windows_Kinect_FrameDescription_AddRefObject(ref this._pNative);
 }
Exemple #8
0
    /// <summary>
    /// Calculates the width of the Depth Frame pixels.
    /// </summary>
    /// <remarks>
    /// not shure if its color pixels or depth!!!!!!!
    /// </remarks>
    /// <returns>The pixel width.</returns>
    /// <param name="description">Description.</param>
    /// <param name="depth">Depth.</param>
    private double CalculatePixelWidth(FrameDescription description, ushort depth)
    {
        // measure the size of the pixel
        float hFov = description.HorizontalFieldOfView / 2;
        float numPixels = description.Width / 2;

        /* soh-cah-TOA
         *
         * TOA = tan(0) = O / A
         *   T = tan( (horizontal FOV / 2) in radians )
         *   O = (frame width / 2) in mm
         *   A = depth in mm
         *
         *   O = A * T
         */

        double T = Mathf.Tan((Mathf.PI * 180) / hFov);
        double pixelWidth = T * depth;

        return pixelWidth / numPixels;
    }
    void Start()
    {
        // Get the description of the depth frames.
        depthFrameDesc = KinectSensor.GetDefault().DepthFrameSource.FrameDescription;
        depthWidth = depthFrameDesc.Width;
        depthHeight = depthFrameDesc.Height;

        // buffer for points mapped to camera space coordinate.
        cameraSpacePoints = new CameraSpacePoint[depthWidth * depthHeight];
        mapper = KinectSensor.GetDefault ().CoordinateMapper;

        // get reference to DepthSourceManager (which is included in the distributed 'Kinect for Windows v2 Unity Plugin zip')
        multiSourceManagerScript = multiSourceManager.GetComponent<MultiSourceManager> ();

        // point cloud
        pointCloud = new Vector3[depthWidth * depthHeight];

        // crate mesh
        CreateMesh(depthWidth / downsampleSize, depthHeight / downsampleSize);

        transform.position = new Vector3(0.0f, 0.0f, 10.0f);
    }