Kinect Face Tracking Using Multiple Kinects SDK 1.8 RRS feed

  • Question

  • I'm trying to face track using 2 Kinects both at the same time but my software only tracks the first Kinect even though I can use both sensors for almost anything else concurrently.

    var faceTrackingViewerBinding = new Binding("Kinect") { Source = sensorChooser };
                faceTrackingViewer.SetBinding(FaceTrackingViewer.KinectProperty,     faceTrackingViewerBinding);
            sensorChooser.KinectChanged += SensorChooserOnKinectChanged;

    There is no way I can tell the "faceTrackingViewer" to use one or both sensors:

    foreach (var sensorItem in KinectSensor.KinectSensors)
                if (sensorItem.Status == KinectStatus.Connected)
                    this.sensorB = sensorItem;
                    this.sensorA = sensorItem;
                    break; // TODO: might not be correct. Was : Exit For
            this.sensorA = KinectSensor.KinectSensors[0];
            this.sensorB = KinectSensor.KinectSensors[1];

    Saturday, October 11, 2014 2:04 PM

All replies

  • You can only set one KinectSensor for each instance of the faceTracker tech. If you want facetracking for both sensors, you would create 2 instances of the FaceTracking object and pass in a different sensor for each. This is key since you cannot pass body data from one sensor to the other given that the different camera spaces are completely different so tracking will be incorrect.

    Carmine Sirignano - MSFT

    Monday, October 13, 2014 6:17 PM
  • Thank you for your reply.

    I have followed your suggestion and created two instances of facetrackingviewer but I am still unsuccessful as there is no way to the each instance which Kinect to use.

     this.sensorA = KinectSensor.KinectSensors[0];
                this.sensorB = KinectSensor.KinectSensors[1];
                var faceTrackingViewerBindingA = new Binding("Kinect") { Source = sensorChooser };
                       face1.SetBinding(FaceTrackingViewer.KinectProperty, faceTrackingViewerBindingA);
                  sensorChooser.KinectChanged += SensorChooserOnKinectChanged;
                       var faceTrackingViewerBindingB = new Binding("Kinect2") { Source = sensorChooser1};
                        face2.SetBinding(FaceTrackingViewer.KinectProperty, faceTrackingViewerBindingB);
                      sensorChooser1.KinectChanged += SensorChooserOnKinectChanged1;

    And I initialised each instance this way:

    private FaceTrackingViewer face1; private FaceTrackingViewer face2; face1 = new FaceTrackingViewer(this); face2 = new FaceTrackingViewer(this); public MainWindow(FaceTrackingViewer inWindow) { face1 = inWindow; face2 = inWindow; }


    Please let me know if I am doing it wrong. I am quite a beginner. If there is a way I can tell which Kinect sensor to use for each instance face1 or face2, the problem would be solved.

    Monday, October 13, 2014 7:49 PM
  • Please follow the samples or documentation on proper way of iterating over the collection of sensors. Do not make assumptions of index or the state the sensor is in. Just to confirm, you are using Kinect for Windows hardware correct? Additionally, these sensors are on their own USB2 host controller?

    Carmine Sirignano - MSFT

    Tuesday, October 14, 2014 5:51 PM
  • Dear Carmine,

    Thank you for the time you have spent on this thread. 

    Yes it is a Kinect for Windows hardware hence "SDK 1.8" in the title.

    In my question I mentioned that "I can use both sensors for almost anything else concurrently" including RGB, Skeleton and Infra-red. The only thing is this face tracking feature.

     Once again, thanks for your comment. I will wait to see if someone comes up with a solution.

    Tuesday, October 14, 2014 8:32 PM