Depth of Field
Pinhole optics have an infinite depth of field. Depth of field is defined as the portion of an image that is in focus. The focus of pinhole optics is not as sharp as an image created by a lens, but all items in view through the pinhole will be equally in focus. Because the light passing through the pinhole is not subject to distortions common with lenses, all things that are straight in the real world will appear straight in the image.
Correcting Refractive Error
Pinhole optics used in eyeglasses or spectacles improve the effective focus of a human eye that has a refractive error. Refractive error--commonly referred to as nearsightedness or farsightedness--changes the point at which an image is focused within the eye.
If the image doesn't focus on the retina, but rather in front of or behind it, the image that is transferred to the brain is out of focus. Pinhole optics allow the eye to focus on smaller bundles of light entering the eye, improving focus. Simply put, it uses a spectacle with a gridwork of pinholes in an opaque material to accomplish the same thing the human body does through squinting.
Reduced Light
Pinhole optics reduce the amount of light that reaches the eye when pinhole glasses are used, or film in the case of a pinhole camera. This allows pinhole glasses to be used effectively as prescription sunglasses. The glasses both correct the vision and reduce the glare of bright sunshine.
Pinhole optics in a camera reduce the amount of light reaching the film. Photographers usually compensate by using a long exposure to allow an adequate amount of light to reach the film and create the image. This allows the photographer to create artistic images that can include the blur of motion to indicate speed or action.