我试图计算两种颜色(如R和绿色)之间的比率,输入是使用opencv检索的相机图像,如果有正确的输入数据,我得到NAN
def slidingMovingAverageWindow(x,y, windowLength):
xS = pd.Series(x)
yS = pd.Series(y)
stdX = xS.rolling(window = windowLength).std()
stdY = yS.rolling(window=windowLength).std()
ratio = np.sqrt(stdX/stdY)
return ratio
def compute_ippg(signal): # using color chorme
B, G, R = cv2.split(signal)
cv2.imshow('Frame', B)
# convert to chrome key
xs = 0.77 * R[2,:] - 0.51 * G[1,:]
ys = 0.77 * R[2,:] + 0.51 * G[1,:] - 0.77 * B[0,:]
a = slidingMovingAverageWindow(xs, ys, 2)
iPPG = xs - a* ys;
return iPPG
窗口为2,您可以对任何图像进行测试,以获得R和G之间的比率
下面一行有问题
ratio = np.sqrt(stdX/stdY) of NaN
目前没有回答
相关问题 更多 >
编程相关推荐