We report terahertz coded-aperture imaging using photo-induced reconfigurable aperture arrays on a silicon wafer. The coded aperture was implemented using programmable illumination from a commercially available digital light processing projector. At 590 GHz, each of the array element apertures can be optically turned on and off with a modulation depth of 20 dB and a modulation rate of 1.3 kHz. Prototype demonstrations of 4 4 coded-aperture imaging using Hadamard coding have been performed. Continuous THz imaging with 8 8 pixels has also been demonstrated, using a slowly moving metal strip as the target. In addition, this technique has been successfully applied to mapping THz beams by using a 6 6 aperture array at 590 GHz. The imaging results agree closely with theoretical calculations based on Gaussian beam propagation, demonstrating that this technique is promising for realizing real-time and low-cost terahertz cameras for many applications. The reported approach provides a simple but powerful means to visualize THz beams, which is highly desired in quasi-optical system alignment, quantum-cascade laser design and characterization, and THz antenna characterization.