Although the human eye is much more complex than any man-made machinery, in simple terms it can be compared to a camera.
Light coming from outside enters the eye via the pupil. The pupil adapts to the level of brightness in the environment, varying in size to let more or less light into the eye.
At the back end of the eye, the retina acts as the image sensor. Its surface is covered with about 120 million photoreceptor cells that react to light intensity (these are called rods) and 6 million cells that enable us to see colors (these are called cones).
Light is focused on the retina by the crystalline lens, which is equivalent to the lens on a camera. When the lens is well-shaped and fits the length of the eye, sharp focusing on the retina results in a clear image.
Like a modern camera, the crystalline lens includes an autofocus system. Muscles around the crystalline lens can bend it in order for the eye to focus at up-close distances.
A normal eye can see at far distances without muscular effort, but when looking at near distances, these muscles are constantly contracted. Imagine trying to take a macro photo with your phone’s camera: sometimes it struggles to properly focus on subjects up-close, and our eyes are no different!