CHROM Python API¶
-
bob.rppg.chrom.extract_utils.
compute_mean_rgb
(image, mask=None)[source]¶ computes the mean R, G and B of an image.
Note that a mask could be provided to tell which pixels should be taken into account when computing the mean.
Parameters: - image (numpy.ndarray) – The image to process
- mask (numpy.ndarray) – Mask of the size of the image, telling which pixels should be considered
Returns: - mean_r (float) – The mean red value
- mean_g (float) – The mean green value
- mean_b (float) – The mean blue value
-
bob.rppg.chrom.extract_utils.
compute_gray_diff
(previous, current)[source]¶ computes the difference in intensity between two images.
Parameters: - previous (numpy.ndarray) – The previous frame.
- current (numpy.ndarray) – The current frame.
Returns: The sum of the absolute difference in pixel intensity between two frames
Return type:
-
bob.rppg.chrom.extract_utils.
select_stable_frames
(diff, n)[source]¶ selects a stable subset of consecutive frames
The selection is made by considering the grayscale difference between frames. The subset is chosen as the one for which the sum of difference is minimized
Parameters: - diff (numpy.ndarray) – The sum of absolute pixel intensity differences between consecutive frames, across the whole sequence.
- n (int) – The number of consecutive frames you want to select.
Returns: index – The frame index at which the stable segment begins.
Return type:
-
bob.rppg.chrom.extract_utils.
project_chrominance
(r, g, b)[source]¶ Projects rgb values onto the x and y chrominance space
See equation (9) of [dehaan-tbe-2013].
Parameters: Returns: - x (float) – The x value
- y (float) – The y value