In previous studies, an electronic portal imaging device (EPID) in cine mode was used for validating respiratory gating and stereotactic body radiation therapy (SBRT) by tracking implanted fiducials. The manual marker tracking methods that were used were time and labor intensive, limiting the utility of the validation. The authors have developed an automatic algorithm to quickly and accurately extract the markers in EPID images and reconstruct their 3D positions. Studies have been performed with gold fiducials placed in solid water and dynamic thorax phantoms. In addition, the authors have examined the cases of five patients being treated under an SBRT protocol for hepatic metastases. For each case, a sequence of images was created by collecting the exit radiation using the EPID. The markers were detected and recognized using an image processing algorithm based on the Laplacian of Gaussian function. To reduce false marker detection, a marker registration technique was applied using image intensity as well as the geometric spatial transformations between the reference marker positions produced from the projection of 3D CT images and the estimated marker positions. An average marker position in 3D was reconstructed by backprojecting, towards the source, the position of each marker on the 2D image plane. From the static phantom study, spatial accuracies of <1 mm were achieved in both 2D and 3D marker locations. From the dynamic phantom study, using only the Laplacian of the Gaussian algorithm, the marker detection success rate was 88.8%. However, adding a marker registration technique which utilizes prior CT information, the detection success rate was increased to 100%. From the SBRT patient study, intrafractional tumor motion (3.1-11.3 mm) in the SI direction was measured using the 2D images. The interfractional patient setup errors (0.1-12.7 mm) in the SI, AP, and LR directions were obtained from the average marker locations reconstructed in 3D and compared to the reference planning CT image. The authors have developed an automatic algorithm to extract marker locations from MV images and have evaluated its performance. The measured intrafractional tumor motion and the interfractional daily patient setup error can be used for off-line retrospective verification of SBRT.