The invention provides for a medical apparatus (100, 200, 300, 500) comprising an optical imaging system (106) configured for acquiring a series of optical images (544) descriptive of cardiac motion of a subject (102). The medical apparatus further comprises a memory (534) for storing machine executable instructions (540). The medical apparatus further comprises a processor (530) for controlling the medical apparatus. Execution of the machine executable instructions causes the processor to repeatedly: acquire (400) a series of images using the optical imaging system, wherein the series of images are acquired at a rate of at least 10 frames per second; and derive (402) a cardiac motion signal (546) from the series of images, wherein the cardiac motion signal is derived by tracking motion of at least a group of pixels within the series of images.