2SR Python API¶
-
bob.rppg.ssr.ssr_utils.
get_skin_pixels
(face_frame, index, facewidth, skininit, threshold, bounding_boxes=None, skin_frame=None, plot=False) → skin_pixels[source]¶ Get a list of skin colored pixels inside the given frame.
Parameters
face_frame
(numpy array):- The frame where the face has to be detected.
index
(int):- The index of the frame containing the face to be detected.
skininit
(boolean):- Flag if you want the parameters of the skin model to be re-estimated.
threshold
(float [0-1]):- The threshold on the skin color probability.
bounding_boxes
(list of BoundingBoxes):- The face bounding boxes corresponding to the sequence.
skin_frame
(numpy array):- The frame where the skin pixels have to be retrieved. If not set, face_frame will be used.
plot
(boolean):- Flag to plot the result of skin pixels detection
Returns
skin_pixels
(numpy array):- The RGB values of all detected skin colored pixels
-
bob.rppg.ssr.ssr_utils.
get_eigen
(skin_pixels) → eigenvalues, eigenvectors[source]¶ Build the C matrix, get eigenvalues and eigenvectors, sort them.
Parameters
skin_pixels
(numpy array):- The RGB values of skin-colored pixels.
Returns
eigenvalues
(numpy array):- The eigenvalues of the correlation matrix
eigenvectors
(numpy array):- The (sorted) eigenvectors of the correlation matrix
-
bob.rppg.ssr.ssr_utils.
plot_eigenvectors
(skin_pixels, eigenvectors, counter)[source]¶ Plots skin pixel cluster and eignevectors in the RGB space.
Parameters
skin_pixels
(numpy array):- The RGB values of skin-colored pixels.
eigenvectors
(numpy array):- The eigenvectors of the correlation matrix.
-
bob.rppg.ssr.ssr_utils.
build_P
(counter, temporal_stride, eigenvectors, eigenvalues, plot=False) → p[source]¶ Builds P
Parameters
counter
(int):- The frame index
temporal_stride
(int):- The temporal stride to use
eigenvectors
(numpy array):- The eigenvectors of the c matrix (for all frames up to counter).
eigenvalues
(numpy array):- The eigenvalues of the c matrix (for all frames up to counter).
plot
(boolean):- If you want something to be plotted
Returns
p
(numpy array):- The p signal to add to the pulse.