Q:

how to calculate head pose using opencv?

I tracked the pupil in a video. Now, the problem is that we need to find the pose and map the pupil location to a given area on the screen. Is there a way to do that ?

A:

I think this is what you need:
Simple accurate eye center tracking in opencv
This is an open source project that keeps track of the position of the pupil related to a box around the eye. With that information you would be able to know with a certain threshold which direction the eyes are looking at.
Then it will be possible to know at which quadrant the person is currently looking with something like this:
double dLookFactorX = pupilX - boxLeftEdgeX;
double dLookFactorY = pupilY - boxTopEdgeY;

if (dLookFactorX <= 0) { // right part
    if (dLookFactorY >= 0) // upper part
        return 1; // first quadrant
    else // lower part
        return 4; // fourth quadrant
} else { // left part
    if (dLookFactorY >= 0) // upper part
        return 2; // second quadrant
    else // lower part
        return 3; // third quadrant
}

