The image shift amount between the A-image and the B-image is calculated for each rectangular area obtained by dividing the unit pixel cells 200 arranged in a two-dimensional matrix illustrated in FIG. 2B into N×M. The calculation area is determined according to the output of the focus detecting calculation area selecting unit 109 of the previous frame. The position where the object exists is selected based on the obtained N×M focus detecting calculation results and the coordinates (position) of the focus detecting calculation area of the current frame. Due to this control, lens driving control with low latency (low delay time) can be acquired without waiting for the processing of the object detecting unit 108 to the current frame. The range and position of the focus detecting calculation area are determined according to the output signal from the focus detecting calculation area selecting unit 109.
Referring now to FIGS. 3A to 3C, a description will be given of the principle of focus detection using a phase difference. FIGS. 3A to 3C explain the principle of focus detection using the image sensor 102. The image sensor 102 illustrated in FIGS. 3A to 3C has a plurality of unit pixel cells 200 as described with reference to FIGS. 2A and 2B. The positions of the unit pixel cells 200 are indicated by unit pixel cells P1 to P13, respectively. The pixels 1a and 1b in the unit pixel cell 200 are indicated as pixels A and B, respectively.