How to detect head gesture

Hello everyone!
I’m doing some researches in order to find a particular feature, that is How to manage and detect head gesture. What I’ve found is related just to “nod head for yes”, “right-left movement to say no”, or tracking the head orientation. What I’m looking for is something more specific. Is there any open source code or some example to manage head movements like quick movement of the head from initial position to right/left, to up/down. Any available and “meta-gesture” have already studied/developed?
Thank you!!