Hello there !
I've never tried to work with opencv but in my experince in computer vision tests this question requires well knowledge in neural network algorithms ,so please have a look on this article I'm pretty sure you will find what you want :
Neural Networks on C#[
^]
also this project is much easier to understand and will have what you looking for :
Cam Alarm 2.0 - Alarm system run from a web camera[
^]
hope you find this useful !
Regards and best coding wishes ;)