Lung cancer continues to be the most common type of cancer worldwide. In radiation therapy, high doses of radiation are used to destroy tumors. Adapting radiotherapy to breathing patterns has always been a major concern when dealing with tumors in thoracic or upper abdomen regions. Precise estimation of respiratory signal ensures least damage to healthy tissues surrounding the tumor as well as misrepresentation of the target location. The main objective of this work is to develop a method to extract the breathing signal directly from a given sequence of cone-beam computed tomography (CBCT) projections without depending on any external devices such as spirometer, pressure belt, or implanted infrared markers. The proposed method implements optical flow to track the movement of pixels between each pair of successive CBCT projection images through the entire set of projections. As the optical flow operation results in a high dimensional dataset, dimensionality reduction using linear and kernel based principal component analysis (PCA) are applied on the optical flow dataset to transform it into a lower-dimensional dataset ensuring that only the most distinctive components are present. The proposed method was tested on XCAT phantom datasets1 simulating cases of regular and irregular breathing patterns and cases where the diaphragm was partially visible in certain projection images. The extracted breathing signal using the proposed method was compared to the ground truth signal. Results showed that the extracted signal correlated well with ground truth signal with a mean phase shift not exceeding 1.5 projection in all cases.