A storage unit is configured to store beforehand a table that shows a
relation between spread parameters and command values supplied to a
control unit to acquire a focused image of an object, and information
that designates a command value corresponding to an inflection point on
an approximated curve showing the relation that the spread parameters
have with the command values, the control unit being configured to
control a state of an optical system in accordance with an input command
value. The luminance information about the object that lies at a distance
falling within a range over which focusing should be detected is
acquired, at the position of the optical system, which is obtained by the
command value corresponding to the inflection point shown in the table.