2SR Python API

bob.rppg.ssr.ssr_utils.get_skin_pixels(face_frame, index, skininit, threshold, bounding_boxes=None, skin_frame=None, plot=False)[source]

get a list of skin colored pixels inside the given frame.

Parameters:
  • face_frame (numpy.ndarray) – The frame where the face has to be detected.
  • index (int) – The index of the frame containing the face to be detected.
  • skininit (bool) – Flag if you want the parameters of the skin model to be re-estimated.
  • threshold (float) – The threshold on the skin color probability (between [0, 1]).
  • bounding_boxes (list of bob.ip.facedetect.BoundingBox) – The face bounding boxes corresponding to the sequence.
  • skin_frame (numpy.ndarray) – The frame where the skin pixels have to be retrieved. If not set, face_frame will be used.
  • plot (bool) – Flag to plot the result of skin pixels detection
Returns:

skin_pixels – The RGB values of all detected skin colored pixels

Return type:

numpy.ndarray

bob.rppg.ssr.ssr_utils.get_eigen(skin_pixels)[source]

build the C matrix, get eigenvalues and eigenvectors, sort them.

Parameters:skin_pixels (numpy.ndarray) – The RGB values of skin-colored pixels.
Returns:
  • eigenvalues (numpy.ndarray) – The eigenvalues of the correlation matrix
  • eigenvectors (numpy.ndarray) – The (sorted) eigenvectors of the correlation matrix
bob.rppg.ssr.ssr_utils.plot_eigenvectors(skin_pixels, eigenvectors)[source]

plots skin pixel cluster and eignevectors in the RGB space.

Parameters:
  • skin_pixels (numpy.ndarray) – The RGB values of skin-colored pixels.
  • eigenvectors (numpy.ndarray) – The eigenvectors of the correlation matrix
bob.rppg.ssr.ssr_utils.build_P(counter, temporal_stride, eigenvectors, eigenvalues, plot=False)[source]

builds P

Parameters:
  • counter (int) – The frame index
  • temporal_stride (int) – The temporal stride to use
  • eigenvectors (numpy.ndarray) – The eigenvectors of the c matrix (for all frames up to counter).
  • eigenvalues (numpy.ndarray) – The eigenvalues of the c matrix (for all frames up to counter).
  • plot (bool) – If you want something to be plotted
Returns:

p – The p signal to add to the pulse.

Return type:

numpy.ndarray