A method for ultrasonically measuring a heart rate via a finger, being applied to an ultrasonic fingerprint apparatus, the ultrasonic fingerprint apparatus being arranged below a cover sheet of an electronic device to implement under-display ultrasonic fingerprint identification, the method comprising:
- acquiring, when the finger presses a screen, a correspondence function between an echo signal and a fly time, and determining a target fly time based on the correspondence function, wherein the fly time is a time elapsed from transmission to reception of an ultrasonic signal;
- transmitting the ultrasonic signal to the finger, and receiving a current echo frame that is returned from the finger and carries fingerprint information of the finger based on the target fly time;
- determining a time domain sampling signal based on an inter-frame difference between the current echo frame and a reference frame;
- and
- calculating a heart rate value based on the time domain sampling signal;
- wherein the method further comprises:
- calculating a difference between pixel points of the current echo frame and corresponding pixel points of a last echo frame as an inter-frame difference between the current echo frame and the last echo frame;
- and
- using, in response to the inter-frame difference between the current echo frame and the last echo frame satisfying an inter-frame difference threshold, the current echo frame as the reference frame.