An improved approach to focusing a camera is provided. In one embodiment,
a method of adjusting a focus of a camera includes translating a lens to
a first position. The lens is vibrated relative to the first position,
and a first image is captured on an image sensor while the lens is
vibrated relative to the first position. A first sharpness score
associated with the first image is calculated. The method also includes
translating the lens to a second position. The lens is vibrated relative
to the second position, and a second image is captured on the image
sensor while the lens is vibrated relative to the second position. A
second sharpness score associated with the second image is calculated.
The first and second sharpness scores may be compared, and one of the
first or second positions may be selected based on the comparison.