2013-01-14 15 views
4

我想使用opencv在文件夹中对脸进行分组。使用opencv C++编组相同的脸

我正在玩http://docs.opencv.org/modules/contrib/doc/facerec/facerec_tutorial.html的特征脸示例。但找不到任何东西来解决我的问题。

I have a set of faces in my face database: A,B,C,D,E,F,G,H,I 
As a result I try to get; 
- A,B,D are person1 
- C,E,F are person2 
- G,H are person3 
- I  is person4 

我觉得这个过程应该是这样的;

sampleFace = A 
while 
    mode.train(faces,labels) // trains face database 
    model.predict(sampleFace, &predict, &confidence) // get the prediction 
    using the confidence and similarity percentage decide A,B,D faces are person1 
    remove A,B,D from face database and remove the labels of these images also 
    if faces.size=1 exit loop 
    sampleFace = C 
end of loop 

为了得到这个结果,我想我需要在特征脸样本中为我的模型设置一个阈值。并需要使用置信度值。

其实我想设置一个像%80的相似度分数,那么我想要得到具有给定样本面的相似度得分大于%80的图像。特征脸样本只给出一个具有置信度值的相似面。我需要每个人都有自信的价值,然后我可以比较相似性分数。同样在特征脸样本中,我不知道信心的限制,我需要每个脸部的百分比值。

任何帮助,建议或代码示例将不胜感激。

回答

0

您试图做的方法是基于无监督学习,这在脸部图像上效果不佳。如果你每个人有足够的样本数量,你最好用一个人的图像训练一个分类器;然后为数据集中的每个图像找到最近的类。