2017-08-18 18 views
0

Affectiva Emotion Recognition SDKを初めて使用しました。私はthis linkからのビデオの例に従っていますが、私はいくつかの写真の例をフィードするときthis image顔を検出できませんでした。 私のコードでは、なります -オフラインAffectiva SDKを使用して顔を検出できません

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; 
     } 
    }; 

メインコード私は間違いを犯していないまたはSDKには、いくつかの画像から顔を検出することはできませんされて

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("/home/mitiku/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は、画像中の顔を検出できない次の画像

enter image description hereenter image description here

答えて

2

を使用します。すべての顔を常に検出できる検出器はありません。違う画像でチェックしましたか?

編集:

これら2枚の画像は250×250と260x194と本当に低品質です。より高解像度の画像でアプリをテストすることをお勧めします。 AffectivaのWebページには、最低推奨解像度は320x240、顔は少なくとも30x30であると記載されています。 https://developer.affectiva.com/obtaining-optimal-results/

+0

ほとんどの場合、sdkは顔を検出できません。 – Mitiku

+0

これは一般的ではありません。顔が検出されていない画像の一部を共有できますか? –

関連する問題