In MRI of the human brain, subject motion is a major cause of magnetic resonance image quality degradation. To compensate for the effects of head motion during data acquisition, an in-bore optical motion tracking system is proposed. The system comprises two MR-compatible infrared cameras that are fixed on a holder right above and in front of the head coil. The resulting close proximity of the cameras to the object allows precise tracking of its movement. During image acquisition, the MRI scanner uses this tracking information to prospectively compensate for head motion by adjusting the gradient field direction and radio frequency (RF) phases and frequencies. Experiments performed on subjects demonstrate robust system performance with translation and rotation accuracies of 0.1 mm and 0.15°, respectively. Magn Reson Med, 2009. © 2009 Wiley-Liss, Inc.