A terminal device includes, a processor; and a memory which stores a plurality of instructions, which when executed by the processor, cause the processor to execute, obtaining information that indicates a state of an imaging unit when photographing a subject; determining whether an image photographed by the imaging unit includes blurriness due to shaking of the imaging unit based on the obtained information; and using an image determined as not including blurriness in the determining to detect a line of sight of the photographed subject.