首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用Offline Affectiva SDK检测人脸

无法使用Offline Affectiva SDK检测人脸
EN

Stack Overflow用户
提问于 2017-08-18 19:28:46
回答 1查看 274关注 0票数 0

我是Affectiva情感识别SDK的新手。我一直在遵循this link视频中的示例,但当我提供一些示例this image的图片时,无法检测到人脸。我的代码看起来是:

代码语言:javascript
复制
Listener

    class Listener : public affdex::ImageListener{
        void onImageResults(std::map<affdex::FaceId,affdex::Face> faces,affdex::Frame image){
            std::string pronoun="they";
            std::string emotion="neutral";
            for (auto pair : faces){
                affdex::FaceId faceId=pair.first;
                affdex::Face face=pair.second;
                if(face.appearance.gender==affdex::Gender::Male){
                    pronoun="Male";
                }else if(face.appearance.gender==affdex::Gender::Female){
                    pronoun="Female";
                }

                if(face.emotions.joy>25){
                    emotion="Happy :)";
                }else if(face.emotions.sadness>25){
                    emotion="Sad :(";
                }

                cout<<faceId<<" : "<<pronoun <<" looks "<< emotion <<endl;
            }

        }
        void onImageCapture(affdex::Frame image){
            cout<<"IMage captured"<<endl;
        }
    };

主代码

代码语言:javascript
复制
    Mat img;
    img=imread(argv[1],CV_LOAD_IMAGE_COLOR);
    affdex::Frame frame(img.size().width, img.size().height, img.data, affdex::Frame::COLOR_FORMAT::BGR);
    affdex::PhotoDetector detector(3);
    detector.setClassifierPath("/xxx/xxx/affdex-sdk/data");
    affdex::ImageListener * listener(new Listener());
    detector.setImageListener(listener);
    detector.setDetectAllEmotions(true);
    detector.setDetectAllExpressions(true);
    detector.start();
    detector.process(frame);
    detector.stop();

我哪里搞错了?还是sdk无法从一些图片中检测到人脸?有人能帮我吗?

编辑我使用了下面的图片

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-21 09:57:41

有时SDK无法检测到图片中的人脸。没有一种检测器可以一直检测所有的人脸。你有没有检查过不同的图片?

编辑:

这两张图片的大小分别是250x250和260x194,而且质量非常低。我建议你用更高分辨率的图片来测试这款应用。正如Affectiva在他们的网页中所说的那样,建议的最低分辨率是320x240,面部应该至少是30x30。https://developer.affectiva.com/obtaining-optimal-results/

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45755570

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档