2

I'm trying to run this code from GitHub (Kinectv2HeartRate) which basically calculates the heart rate of the person in front of the kinect. But once it recognizes a face it returns this error

An exception of type 'System.Runtime.InteropServices.SEHException' occurred in Microsoft.Kinect.Face.dll but was not handled in user code Additional information: External component has thrown an exception.

at this line of code:

m_FaceSource = new Microsoft.Kinect.Face.FaceFrameSource(
        m_Sensor, m_CurrentTrackingId, 
        Microsoft.Kinect.Face.FaceFrameFeatures.BoundingBoxInColorSpace | 
        Microsoft.Kinect.Face.FaceFrameFeatures.BoundingBoxInInfraredSpace | 
        Microsoft.Kinect.Face.FaceFrameFeatures.PointsInColorSpace | 
        Microsoft.Kinect.Face.FaceFrameFeatures.PointsInInfraredSpace
);

I've run the FaceBasics code and it gives the same error, but the .exe runs perfectly. Can someone please shed some light on this problem for me?

Laurel
  • 5,965
  • 14
  • 31
  • 57
Joaomsv
  • 21
  • 2
  • 1
    Unrelated to the error, but you may want to import the namespace `Microsoft.Kinect.Face` so that you don't need to keep repeating it in code - makes it a lot more readable ;) – Rob May 09 '16 at 23:21

1 Answers1

0

I'm assuming m_sensor and m_CurrentTrackingId are not null because we wouldn't be able to guess reason behind it.

So we are left with features.

Visiting MSDN reveals requirement to use these features. enter image description here

This link should help you achieve adding lib file.

Community
  • 1
  • 1
Claudius
  • 1,883
  • 2
  • 21
  • 34
  • If a .lib file is missing, the app shouldn't even link. – nobody May 09 '16 at 23:56
  • I´ve added the lib already and it still gives me the same error. I'm seriously lost and I can´t find a reason for this error. – Joaomsv May 10 '16 at 23:18
  • Would you mind showing code how you get these: `m_Sensor, m_CurrentTrackingId, ` – Claudius May 11 '16 at 10:54
  • m_Sensor = Microsoft.Kinect.KinectSensor.GetDefault(); line 224 and this.m_CurrentTrackingId = selectedBody.TrackingId; line 312 – Joaomsv May 11 '16 at 12:23