Schematics of two imaging architectures: (a) In single-pixel imaging, the object is first illuminated by the light source, then imaged by a camera lens onto the focal plane, where a spatial light modulator (SLM) is placed. The SLM modulates the image with different masks, and the reflected or transmitted light intensities are measured by a single-pixel detector. A computational algorithm uses knowledge of the masks. along with their corresponding measurements, to reconstruct an image of the object; (b) in ghost imaging, the object is illuminated by the structured light distribution generated from different masks on an SLM, and the reflected or transmitted light intensities are then measured by a single-pixel detector. A computational algorithm uses knowledge of the masks along, with their corresponding measurements, to reconstruct an image of the object.