External beam irradiation requires precise positioning of the target relative to the treatment planning coordinate system. A three-dimensional (3D) surface imaging system for patient positioning has recently been installed in one of our linear accelerator (linac) rooms. The device utilizes close-range photogrammetry to generate a 3D model of the patient's surface. This geometric model can be made to look like a digital camera image if wrapped with a gray-level image (texture mapping) that shows surface coloration. The system is calibrated to the linac coordinate system and has been designed as a patient setup device. To reproduce patient position in fractionated radiotherapy, the daily patient surface model is registered to a previously recorded reference surface. Using surface registration, the system calculates the rigid-body transformation that minimizes the distance between the treatment and the reference surface models in a region-of-interest (ROI). This transformation is expressed as a set of new couch coordinates at which the patient position best matches with the reference data. If respiratory motion is a concern, the surface can be obtained with a gated acquisition at a specified phase of the respiratory cycle. To analyze the accuracy of the system, we performed several experiments with phantoms to assess stability, alignment accuracy, precision of the gating function, and surface topology. The reproducibility of surface measurements was tested for periods up to 57 h. Each recorded frame was registered to the reference surface to calculate the required couch adjustment. The system stability over this time period was better than 0.5 mm. To measure the accuracy of the system to detect and quantify patient shift relative to a reference image, we compared the shift detected by the surface imaging system with known couch transitions in a phantom study. The maximum standard deviation was 0.75 mm for the three translational degrees of freedom, and less than 0.1 degrees for each rotation. Surface model precision was tested against computed tomography (CT)-derived surface topology. The root-mean-square rms of the distance between the surfaces was 0.65 mm, excluding regions where beam hardening caused artifacts in the CT data. Measurements were made to test the gated acquisition mode. The time-dependent amplitude was measured with the surface imaging system and an established respiratory gating system based on infrared (IR)-marker detection. The measured motion trajectories from both systems were compared to the known trajectory of the stage. The standard deviations of the amplitude differences to the motor trajectory were 0.04 and 0.15 mm for the IR-marker system and the 3D surface imaging system, respectively. A limitation of the surface-imaging device is the frame rate of 6.5 Hz, because rapid changes of the motion trajectory cannot be detected. In conclusion, the system is accurate and sufficiently stable to be used in the clinic. The errors computed when comparing the surface model with CT geometry were submillimeter, and deviations in the alignment and gating-signal tests were of the same magnitude.