我是Affectiva情感识别SDK的新手。我一直在遵循this link视频中的示例,但当我提供一些示例this image的图片时,无法检测到人脸。我的代码看起来是:
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;
}
};主代码
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无法从一些图片中检测到人脸?有人能帮我吗?
编辑我使用了下面的图片


发布于 2017-08-21 09:57:41
有时SDK无法检测到图片中的人脸。没有一种检测器可以一直检测所有的人脸。你有没有检查过不同的图片?
编辑:
这两张图片的大小分别是250x250和260x194,而且质量非常低。我建议你用更高分辨率的图片来测试这款应用。正如Affectiva在他们的网页中所说的那样,建议的最低分辨率是320x240,面部应该至少是30x30。https://developer.affectiva.com/obtaining-optimal-results/
https://stackoverflow.com/questions/45755570
复制相似问题