Exemplo n.º 1
0
        private void initFubi()
        {
            List <string> availableSensors = new List <string>();

            availableSensors.Add(Enum.GetName(typeof(FubiUtils.SensorType), FubiUtils.SensorType.NONE));
            FubiUtils.SensorType type = FubiUtils.SensorType.NONE;
            int avSensors             = Fubi.getAvailableSensors();

            if ((avSensors & (int)FubiUtils.SensorType.OPENNI2) != 0)
            {
                type = FubiUtils.SensorType.OPENNI2;
                availableSensors.Add(Enum.GetName(typeof(FubiUtils.SensorType), type));
            }
            if ((avSensors & (int)FubiUtils.SensorType.KINECTSDK) != 0)
            {
                if (type == FubiUtils.SensorType.NONE)
                {
                    type = FubiUtils.SensorType.KINECTSDK;
                }
                availableSensors.Add(Enum.GetName(typeof(FubiUtils.SensorType), FubiUtils.SensorType.KINECTSDK));
            }
            if ((avSensors & (int)FubiUtils.SensorType.OPENNI1) != 0)
            {
                if (type == FubiUtils.SensorType.NONE)
                {
                    type = FubiUtils.SensorType.OPENNI1;
                }
                availableSensors.Add(Enum.GetName(typeof(FubiUtils.SensorType), FubiUtils.SensorType.OPENNI1));
            }
            string selectedName = Enum.GetName(typeof(FubiUtils.SensorType), type);

            foreach (string sType in availableSensors)
            {
                int index = sensorSelectionComboBox.Items.Add(sType);
                if (index > -1 && sType == selectedName)
                {
                    sensorSelectionComboBox.SelectedIndex = index;
                }
            }
            switchSensorOnNextUpdate = false;

            Fubi.init(new FubiUtils.SensorOptions(new FubiUtils.StreamOptions(640, 480, 30), new FubiUtils.StreamOptions(640, 480), new FubiUtils.StreamOptions(-1, -1, -1), type));
            Fubi.loadRecognizersFromXML("MouseControlRecognizers.xml");
        }