Whether a portrait photography mode has been set is determined. A first
threshold value is set when the portrait photography mode has been set
and a second threshold value that is smaller than the first threshold
value is set when the portrait photography mode has not been set. A
cross-correlation coefficient between the image of the subject and a
template image is calculated. The calculated coefficient and the set
threshold value are compared and the position of the image of a face is
detected in the image of the subject. When the portrait photography mode
has been set, it can be construed that the subject contains a person and
therefore the position of the face image can be detected comparatively
accurately by increasing the threshold value.