CHROM Python API¶
-
bob.rppg.chrom.extract_utils.
compute_mean_rgb
(image, mask=None) → mean_r, mean_g, mean_b[source]¶ This function 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
(3d numpy array):- The image to process
mask
(2d boolen numpy array):- 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) → diff[source]¶ This function computes the difference in intensity between two images .
Parameters
previous
(3d numpy array):- The previous frame.
current
(3d numpy array):- The current frame.
Returns
diff
(float):- The sum of the absolute difference in pixel intensity between two frames
-
bob.rppg.chrom.extract_utils.
select_stable_frames
(diff, n) → index[source]¶ This functions 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
(1d numpy array):- 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
(int):- The frame index at which the stable segment begins.
-
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
r
(float):- The red value
g
(float):- The green value
b
(float):- The blue value
Returns
x
(float):- The x value
y
(float):- The y value