要写一个评测人脸识别性能的程序
把live 和 sfz 里面所有的图片的特征提取出来,两两计算相似度,这样我们就得到一个相似度矩阵。
把live 的特征和sfz 的特征都推到堆栈里面去。
BYTE* pFeature1 = new BYTE[EF_Size()];
BYTE* pFeature2 = new BYTE[EF_Size()];
EF_Extract(0, img_gallary.data, img_gallary.cols, img_gallary.rows, 3, &ptfp[max_face_index], pFeature1);
EF_Extract(0, img_live.data, img_live.cols, img_live.rows, 3, &ptfp2[0], pFeature2);
featureDB_live.push_back(pFeature2);
featureDB_sfz.push_back(pFeature1);
for (int m = 0; m < featureDB_sfz.size(); m++)
{
for (int n = 0; n < featureDB_live.size();n++)
{
float score = 0;
score = EF_Compare(featureDB_live[m], featureDB_sfz[n]);
fprintf(fp,"%f ",score);
}
fprintf(fp,"\n");
}
堆栈每次都要分配内存,不然如果只申请一次,就会所有的指针都指向同一块内存,所有的结果都一样。