树莓派嵌入式系统中的人脸识别与监控技术
1. 人脸识别方法
在人脸识别领域,Eigenfaces和Fisherfaces是两种常用的方法。Fisherfaces和Eigenfaces一样,允许对投影图像进行重建。但由于Fisherfaces主要用于识别区分不同主体的特征,所以它对原始图像的近似效果并不如Eigenfaces。以下是一段使用Fisherfaces进行图像重建的Python代码:
from tinyfacerec.subspace import project , reconstruct
E = []
for i in xrange(min(W.shape[1], 16)):
e = W[:,i].reshape(-1,1)
P = project(e, X[0].reshape(1,-1), mu)
R = reconstruct(e, P, mu)
# reshape and append to plots
R = R.reshape(X[0].shape)
E.append(normalize(R,0,255))
# plot them and store the plot to "python_reconstruction.pdf"
subplot(title="Fisherfaces Reconstruction Yale FDB", images=E, rows=4, cols=4, sptitle ="Fisherface", colormap=cm.gray, filename="python_fisherfaces_reconstruction.pd