Cardiac arrhythmia has been defined as one of the abnormal heart rhythm symptoms, which is a common problem dealt with by cardiologists. Zebrafish were established as a powerful animal model with a transparent body that enables optical observation to analyze cardiac morphology and cardiac rhythm regularity. Currently, research has observed heart-related parameters in zebrafish, which used different approaches, such as starting from the use of fluorescent transgenic zebrafish, different software, and different observation methods. In this study, we developed an innovative approach by using the OpenCV library to measure zebrafish larvae heart rate and rhythm. The program is designed in Python, with the feature of multiprocessing for simultaneous region-of-interest (ROI) detection, covering both the atrium and ventricle regions in the video, and was designed to be simple and user-friendly, having utility even for users who are unfamiliar with Python. Results were validated with our previously published method using ImageJ, which observes pixel changes. In summary, the results showed good consistency in heart rate-related parameters. In addition, the established method in this study also can be widely applied to other invertebrates (like Daphnia) for cardiac rhythm measurement.