Objective: We describe the development and testing of a motion correction method for flat panel imager-based cone beamCT (CBCT) based on warping of projection images. Methods: Markerswithin or on the surface of the patientwere tracked and their mean three-dimensional (3D) position calculated. The two-dimensional (2D) cone beam projection images were then warped before reconstruction to place each marker at the projection from its mean 3D position. The motion correction method was tested using simulated cone beam projection images of a deforming virtual phantom, real CBCT images of a moving breast phantom and clinical CBCT images of a patient with breast cancer and another with pancreatic cancer undergoing radiotherapy. Results: In phantom studies, the method was shown to greatly reduce motion artefacts in the locality of the radiotherapy target and allowed the true surface shape to be accurately recovered. The breast phantom motion-compensated surface was within 1 mm of the true surface shape for 90% of surface points and greater than 2 mm from the true surface at only 2% of points. Clinical CBCT images showed improved image quality in the locality of the radiotherapy target after motion correction. Conclusion: The proposed method is effective in reducing motion artefacts in CBCT images. © 2011 The British Institute of Radiology.