We use RR-intervals (the intervals between heartbeats) in order to estimate key indicators. You can read more about the process here. It means we use devices that read heartbeats and counts the time between beats.
All devices that measure HRV fall into one of the following categories:
Passive electric/electrocardiography/ECG – get an electric signal from the heart. All chest straps, like Polar and Garmin, belong to this category.
Photoplethysmography/PPG – use a bright light to track the transparency levels of blood vessels, which change as the heartbeats and blood flows in and out of blood vessels. This is how the Apple Watch and camera measurements work.
Studies that compare data obtained through electrocardiography and photoplethysmography show that both methods are suitable for measuring HRV.
Important note: although the electrocardiography technique is used for taking HRV measurements with chest straps, HRV measurement is not an electrocardiogram recording, and it can't be used as a substitute for ECG or a medical check-up.
The measurement methods have different levels of accuracy (the camera has a margin of error of about 5-7%), but all of them can be used to track general trends.