The history of the pinhole camera goes hand in hand with the history of camera obscura (darkroom). The camera obscura was used on the 17th century by landscape painters and architects in order to achieve a realistic representation of natural and artificial landscapes.
The camera obscura is a box impervious to light, with a hole in the center of one side. As light passes through this hole it forms an inverted image of the external environment on the inner, opposite side of the box. The image preserves the colors and the perspective of reality. The use of a mirror corrects the image’s inversion. The result is a picture with photographic precision that can be easily copied.
The pinhole camera is a dark room (camera obscura) where the image is projected onto a photosensitive surface ( film or CCD) to produce a photograph either analog or digital.