An ophthalmic apparatus includes an illumination optical system which projects an illumination light beam from an illumination light source onto the fundus of the eye to be examined and an imaging optical system which guides reflected light from the fundus to imaging part. The ophthalmic apparatus calculates the contrast value of the fundus image formed by the imaging part, and focuses the imaging optical system on the fundus by moving a focus lens in the optical-axis direction of the imaging optical system based on the contrast value obtained by the calculation. The apparatus adjusts the contrast value obtained by the above calculation based on the position of the focus lens in the optical-axis direction.