Pinhole cameras have been used for imaging in the high energy radiation domain, e.g., for X-rays or gamma-rays, when lenses or other focussing devices can no longer be used. The main problem with pinhole cameras is the contradiction between the resolution - which requires small pinholes, and the sensitivity - which asks for large apertures. The paper discusses the coded aperture approach which uses a coding mask with a large number of pinholes and a reconstruction of the image by correlation with a corresponding decoding mask. Very good results have been achieved this way in high-energy astronomy, but difficulties persist in biologic and medical imaging, in particular in single-photon emission computed tomography (SPECT), because of the artifacts in the near-field imaging.