|
from scipy import signal |
|
import numpy as np |
|
from .base import VHRMethod |
|
|
|
class CHROM(VHRMethod): |
|
""" This method is described in the following paper: |
|
"Remote heart rate variability for emotional state monitoring" |
|
by Y. Benezeth, P. Li, R. Macwan, K. Nakamura, R. Gomez, F. Yang |
|
""" |
|
methodName = 'CHROM' |
|
|
|
def __init__(self, **kwargs): |
|
super(CHROM, self).__init__(**kwargs) |
|
|
|
def apply(self, X): |
|
|
|
|
|
|
|
|
|
|
|
Xcomp = 3*X[0] - 2*X[1] |
|
Ycomp = (1.5*X[0])+X[1]-(1.5*X[2]) |
|
|
|
|
|
sX = np.std(Xcomp) |
|
sY = np.std(Ycomp) |
|
|
|
alpha = sX/sY |
|
|
|
|
|
bvp = Xcomp-alpha*Ycomp |
|
|
|
return bvp |