Multithreading Aforge directshow to display camera Stream and recognize emotions

150 Views Asked by At

I am using the affdex SDK to detect emotions and while the detection of emotions I need to display the camera stream to the users to be able to see themselves, I am using the Aforge library and the Affdex SDk. when I wrote both in the main thread the camera stream worked fine but the emotion detection stopped, so I tried threading but still the camera is enabled but the detection doesn't work. any idea how to solve this issue?

Threading part:

Thread camThread = new  Thread(camStart);
        camThread.Start();

public void camStart()
    {
        videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
        videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
        videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
        CloseVideoSource();
        videoSource.Start();
    }
1

There are 1 best solutions below

0
Matt S On

The affdexMe app might give some clues about how to do this as it provides a similar feature that you describe: https://github.com/Affectiva/affdexme-win