Cardiac restitution is the shortening of the action potential duration with an increase in the heart rate. A shorter action potential duration enables a longer diastolic interval which ensures that the heart gets adequate time to refill with blood. At higher rates however, restitution becomes steep and thus, can lead to unstable electrical activity (alternans) in the heart, leading to fatal cardiac rhythms. It has been proposed that maintaining a shallow slope of cardiac restitution could have potentially anti-arrhythmic effects. Previous studies involved the control of action potential duration (APD) or diastolic interval (DI) in isolated tissue samples based on the feedback from single microelectrode recordings. This limited the spatial resolution of the feedback system. Here, we aimed to develop a real time feedback control system that enabled the detection of APDs from various single pixels based on optical mapping recordings. Stimuli were applied after a predefined fixed DI after detection of an APD. We validated our algorithm using optical mapping movies from an ex-vivo rabbit heart. Thus, we provide an optical mapping based approach for the control of cardiac restitution and a potential means to validate its anti-arrhythmic effects.