Text this: Detection of head position using chain code algorithm