#寻找峰谷,并进行标记;
sig = bodyPart4['dis'].to_numpy()
sigAv = moving_average(sig, 3)#做一下简单的滑动平均
plt.plot(sigAv, 'g')
np.savetxt(r"D:\PythonProject\QTNLS\resources\t7\hand-dis-ave.csv", sigAv, delimiter=",")
sig2 = sigAv*(-1) + 200 #转换为求波谷
plt.plot(sig2, color = 'red',label = '-bodyPart3')
from scipy.signal import find_peaks
peaks, _ = find_peaks(sig2, height=0,distance=3)#两个峰值之间要间隔10帧,据观察,3帧就可以完成一次洗脸
plt.plot(peaks, sigAv[peaks], "x")
print(peaks)
plt.show()
bodyPart4['dis'].to_csv(r'D:\PythonProject\QTNLS\resources\t7\hand-dis.csv',index=False)