Esempio n. 1
0
    // Input processor
    //InputProcessor inputProcessor;


    // Use this for initialization
    void Start()
    {
        // Find a Kinect sensor
        KinectSensorCollection kinectSensors = KinectSensor.KinectSensors;

        if (kinectSensors.Count == 0)
        {
            this.sensor = null;
            throw new UnityException("Could not find a Kinect sensor.");
        }

        // Enable the skeleton stream
        this.sensor = kinectSensors[0];
        this.sensor.SkeletonStream.Enable();
        if (!this.sensor.SkeletonStream.IsEnabled)
        {
            throw new UnityException("Sensor could not be enabled.");
        }

        // Create the input processor
        seatedInfoProcessor = new SeatedInfoProcessor();
        seatedInfo          = null;

        Debug.Log("Hello");
        return;
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        // Find a Kinect sensor
        KinectSensorCollection kinectSensors = KinectSensor.KinectSensors;

        if (kinectSensors.Count == 0)
        {
            this.sensor = null;
            throw new UnityException("Could not find a Kinect sensor.");
        }

        // Enable the skeleton stream
        this.sensor = kinectSensors[0];
        this.sensor.SkeletonStream.Enable();
        if (!this.sensor.SkeletonStream.IsEnabled)
        {
            throw new UnityException("Sensor could not be enabled.");
        }

        // Create the input processor
        inputProcessor = new InputProcessor(this.sensor.CoordinateMapper, DepthImageFormat.Resolution320x240Fps30);
        this.InputInfo = inputProcessor.GameInputInfo;

        Debug.Log("Hello");
        return;
    }
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            KinectSensorCollection ksc = KinectSensor.KinectSensors;

            foreach (var item in ksc)
            {
                this.comboBox1.Items.Add(item.UniqueKinectId);
            }
        }
Esempio n. 4
0
        public KClient(KTcp _server, TcpClient _client, KinectSensorCollection _sensorList)
        {
            client = _client;
            server = _server;
            sensorList = _sensorList;

            threadClient = new Thread(new ThreadStart(clientComm));
            threadClient.Name = "Client " + ((IPEndPoint)client.Client.RemoteEndPoint).Address;
            threadClient.Start();
        }
Esempio n. 5
0
        public KClient(KTcp _server, TcpClient _client, KinectSensorCollection _sensorList)
        {
            client     = _client;
            server     = _server;
            sensorList = _sensorList;

            threadClient      = new Thread(new ThreadStart(clientComm));
            threadClient.Name = "Client " + ((IPEndPoint)client.Client.RemoteEndPoint).Address;
            threadClient.Start();
        }
Esempio n. 6
0
 public KTcp(short _port) : base(IPAddress.Any, _port)
 {
     clients               = new List <KClient>();
     sensorList            = KinectSensor.KinectSensors;
     threadWaitClient      = new Thread(new ThreadStart(waitClient));
     threadWaitClient.Name = "waitClient";
     threadWaitClient.Start();
     threadWaitClient.Join();
     Console.WriteLine("Kinect Server : Server Stopped !");
     Console.WriteLine("Press Any Key to continue !");
     Console.ReadKey();
 }
Esempio n. 7
0
 public KTcp(short _port)
     : base(IPAddress.Any,_port)
 {
     clients = new List<KClient>();
     sensorList = KinectSensor.KinectSensors;
     threadWaitClient = new Thread(new ThreadStart(waitClient));
     threadWaitClient.Name = "waitClient";
     threadWaitClient.Start();
     threadWaitClient.Join();
     Console.WriteLine("Kinect Server : Server Stopped !");
     Console.WriteLine("Press Any Key to continue !");
     Console.ReadKey();
 }
Esempio n. 8
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            sensorCollection = KinectSensor.KinectSensors;
            sensor = sensorCollection[0];
            sensor.SkeletonStream.Enable();
            sensor.Start();

            // register event handler for the allframesready event.
            sensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(KinectAllFramesReady);

            // allocate memory for skeleton data.
            this.skeletonData = new Skeleton[sensor.SkeletonStream.FrameSkeletonArrayLength];

            base.Initialize();
        }
Esempio n. 9
0
        public KinectStatus Start()
        {
            _sensors = KinectSensor.KinectSensors;
            if (_sensors.All(x => x.Status != KinectStatus.Connected))
            {
                return KinectStatus.NotReady;
            }
            _sensors.ToList().ForEach(s=>
                                          {

                                              s.SkeletonStream.Enable();
                                              //s.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                                              s.SkeletonFrameReady += (sender, args) => AddToObservableSkeletons(args);
                                              s.Start();
                                          });

            return KinectStatus.Connected;
        }
Esempio n. 10
0
        //public ShellViewModel(IWindowManager windowManager)
        //{
        //    _windowManager = windowManager;
        //}
        protected override void OnActivate()
        {
            base.OnActivate();
            _sensors = KinectSensor.KinectSensors;

            if(_sensors.Any(x => x.Status != KinectStatus.Connected))
            {
                Application.Current.Shutdown();

            }

            _activeSensor = _sensors.First(x => x.Status == KinectStatus.Connected);

            _activeSensor.SkeletonStream.Enable();
            _activeSensor.SkeletonFrameReady += (sender, args) => { };
            _activeSensor.Start();

            //TODO: Seated??
        }
Esempio n. 11
0
        //constructor.
        public Program()
        {
            readConfig(@"C:\CASAS_Kinect\app.conf");

            factory.HostName = appConfig["rabbithost"];
            factory.UserName = appConfig["rabbituser"];
            factory.Password = appConfig["rabbitpass"];
            factory.Port = Convert.ToInt32(appConfig["rabbitport"]);
            factory.VirtualHost = appConfig["rabbitvhost"];

            connection = factory.CreateConnection();

            System.Threading.Thread.Sleep(2000);

            sensors = KinectSensor.KinectSensors;
            sensors.StatusChanged += sensors_StatusChanged;

            jsserializer = new JavaScriptSerializer();

            foreach (KinectSensor ks in sensors)
            {
                try
                {
                    if (ks.Status == KinectStatus.Connected)
                    {
                        StartSensor(ks);
                    }
                }
                catch (Exception ex)
                {

                    saveLocal("\nError Encountered: "+ ex.Message);

                }

            }
        }
Esempio n. 12
0
 public KAction(NetworkStream arg)
 {
     sensors = KinectSensor.KinectSensors;
     ns      = arg;
     rData   = "";
 }
Esempio n. 13
0
 public KAction(NetworkStream arg)
 {
     sensors = KinectSensor.KinectSensors;
     ns = arg;
     rData = "";
 }