SetSkeletonSmoothing() приватный Метод

private SetSkeletonSmoothing ( double factor ) : void
factor double
Результат void
Пример #1
0
    void Start()
    {
        uint rc = NiteWrapper.Init(new StringBuilder(".\\OpenNI.xml"));

        if (rc != 0)
        {
            Debug.Log(String.Format("Error initing OpenNI: {0}", Marshal.PtrToStringAnsi(NiteWrapper.GetStatusString(rc))));
        }

        // Init depth & label map related stuff
        usersMapSize      = NiteWrapper.GetDepthWidth() * NiteWrapper.GetDepthHeight();
        usersLblTex       = new Texture2D(NiteWrapper.GetDepthWidth(), NiteWrapper.GetDepthHeight());
        usersMapColors    = new Color[usersMapSize];
        usersMapRect      = new Rect(Screen.width - usersLblTex.width / 2, Screen.height - usersLblTex.height / 2, usersLblTex.width / 2, usersLblTex.height / 2);
        usersLabelMap     = new short[usersMapSize];
        usersDepthMap     = new short[usersMapSize];
        usersHistogramMap = new float[5000];

        // text
        caption = GameObject.Find("GUI Text").guiText;

        // init our avatar controllers
        soldiers    = new SoldierAvatar[2];
        soldiers[0] = new SoldierAvatar(GameObject.Find("Soldier1"));
        //soldiers[1] = new SoldierAvatar(GameObject.Find("Soldier2")); // This line was removed so we can have 1 soldier without errors

        // init user lists - one will contain all users, the second will contain only calibrated & mapped users
        allUsers        = new List <uint>();
        calibratedUsers = new Dictionary <uint, SoldierAvatar>();

        // init user callbacks
        NewUser            = new NiteWrapper.UserDelegate(OnNewUser);
        CalibrationStarted = new NiteWrapper.UserDelegate(OnCalibrationStarted);
        CalibrationFailed  = new NiteWrapper.UserDelegate(OnCalibrationFailed);
        CalibrationSuccess = new NiteWrapper.UserDelegate(OnCalibrationSuccess);
        UserLost           = new NiteWrapper.UserDelegate(OnUserLost);

        // Start looking
        NiteWrapper.StartLookingForUsers(NewUser, CalibrationStarted, CalibrationFailed, CalibrationSuccess, UserLost);
        Debug.Log("Waiting for users to calibrate");

        // set default smoothing
        NiteWrapper.SetSkeletonSmoothing(0.6);
    }
Пример #2
0
    public NiteController(NewUserCallback onNewUser)
    {
        // initialize the Kinect
        uint rc = NiteWrapper.Init(new StringBuilder(".\\OpenNI.xml"));

        if (rc != 0)
        {
            Debug.Log(String.Format("Error initializing OpenNI: {0}", Marshal.PtrToStringAnsi(NiteWrapper.GetStatusString(rc))));
            return;
        }
        else
        {
            kinectConnect = true;
        }

        // init user callbacks
        NewUser            = new NiteWrapper.UserDelegate(OnNewUser);
        CalibrationStarted = new NiteWrapper.UserDelegate(OnCalibrationStarted);
        CalibrationFailed  = new NiteWrapper.UserDelegate(OnCalibrationFailed);
        CalibrationSuccess = new NiteWrapper.UserDelegate(OnCalibrationSuccess);
        UserLost           = new NiteWrapper.UserDelegate(OnUserLost);

        // Start looking
        NiteWrapper.StartLookingForUsers(NewUser, CalibrationStarted, CalibrationFailed, CalibrationSuccess, UserLost);
        Debug.Log("Waiting for users to calibrate");

        // set default smoothing
        NiteWrapper.SetSkeletonSmoothing(0.0);

        // set new user callback
        this.onNewUser = onNewUser;

        // initialize gui
        gui = new NiteGUI(this);

        // initialize list of rigs to animate
        registeredRigs = new List <Rig>();
    }