0

用于人脸分析的 OpenImaj 教程展示了如何使用来自人脸数据库的一些测试图像进​​行人脸识别 - http://openimaj.org/tutorial/eigenfaces.html

如何识别不是来自人脸数据库的新给定图像?能给我举个例子吗?

谢谢。

4

1 回答 1

1

很简单 - 只需修改教程中的代码,这样就不会遍历数据库中的所有面孔,它只需要输入您指定的图像并使用它进行搜索:

    FImage face = ...; //you load the face you want to search with here
    DoubleFV testFeature = eigen.extractFeature(face);

    String bestPerson = null;
    double minDistance = Double.MAX_VALUE;
    for (final String person : features.keySet()) {
        for (final DoubleFV fv : features.get(person)) {
            double distance = fv.compare(testFeature, DoubleFVComparison.EUCLIDEAN);

            if (distance < minDistance) {
                minDistance = distance;
                bestPerson = person;
            }
        }
    }

    System.out.println("Best Guess: " + bestPerson);
于 2016-09-06T08:23:12.567 回答