Add emojis to the output file
This commit is contained in:
parent
4b4e1e05ba
commit
0d8c63f959
3 changed files with 107 additions and 77 deletions
|
@ -41,6 +41,7 @@ class PlottingImageListener : public ImageListener
|
|||
|
||||
std::vector<std::string> expressions;
|
||||
std::vector<std::string> emotions;
|
||||
std::vector<std::string> emojis;
|
||||
std::vector<std::string> headAngles;
|
||||
|
||||
std::map<affdex::Glasses, std::string> glassesMap;
|
||||
|
@ -67,6 +68,15 @@ public:
|
|||
|
||||
headAngles = { "pitch", "yaw", "roll" };
|
||||
|
||||
|
||||
emojis = std::vector<std::string> {
|
||||
"relaxed", "smiley", "laughing",
|
||||
"kissing", "disappointed",
|
||||
"rage", "smirk", "wink",
|
||||
"stuckOutTongueWinkingEye", "stuckOutTongue",
|
||||
"flushed", "scream"
|
||||
};
|
||||
|
||||
genderMap = std::map<affdex::Gender, std::string> {
|
||||
{ affdex::Gender::Male, "male" },
|
||||
{ affdex::Gender::Female, "female" },
|
||||
|
@ -79,10 +89,11 @@ public:
|
|||
{ affdex::Glasses::No, "no glasses" }
|
||||
};
|
||||
|
||||
fStream << "TimeStamp,faceId,interocularDistance,glasses,gender,";
|
||||
fStream << "TimeStamp,faceId,interocularDistance,glasses,gender,dominantEmoji,";
|
||||
for (std::string angle : headAngles) fStream << angle << ",";
|
||||
for (std::string emotion : emotions) fStream << emotion << ",";
|
||||
for (std::string expression : expressions) fStream << expression << ",";
|
||||
for (std::string emoji : emojis) fStream << emoji << ",";
|
||||
fStream << std::endl;
|
||||
fStream.precision(4);
|
||||
fStream << std::fixed;
|
||||
|
@ -162,10 +173,11 @@ public:
|
|||
{
|
||||
if (faces.empty())
|
||||
{
|
||||
fStream << timeStamp << "nan,nan,no glasses,unknown,";
|
||||
fStream << timeStamp << "nan,nan,no glasses,unknown, unknown,";
|
||||
for (std::string angle : headAngles) fStream << "nan,";
|
||||
for (std::string emotion : emotions) fStream << "nan,";
|
||||
for (std::string expression : expressions) fStream << "nan,";
|
||||
for (std::string emoji : emojis) fStream << "nan,";
|
||||
fStream << std::endl;
|
||||
}
|
||||
for (auto & face_id_pair : faces)
|
||||
|
@ -176,7 +188,8 @@ public:
|
|||
<< f.id << ","
|
||||
<< f.measurements.interocularDistance << ","
|
||||
<< glassesMap[f.appearance.glasses] << ","
|
||||
<< genderMap[f.appearance.gender] << ",";
|
||||
<< genderMap[f.appearance.gender] << ","
|
||||
<< affdex::EmojiToString(f.emojis.dominantEmoji) << ",";
|
||||
|
||||
float *values = (float *)&f.measurements.orientation;
|
||||
for (std::string angle : headAngles)
|
||||
|
@ -198,6 +211,14 @@ public:
|
|||
fStream << (*values) << ",";
|
||||
values++;
|
||||
}
|
||||
|
||||
values = (float *)&f.emojis;
|
||||
for (std::string emoji : emojis)
|
||||
{
|
||||
fStream << (*values) << ",";
|
||||
values++;
|
||||
}
|
||||
|
||||
fStream << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +247,7 @@ public:
|
|||
const int left_margin = 30;
|
||||
|
||||
|
||||
cv::Scalar clr = cv::Scalar(255, 255, 255);
|
||||
cv::Scalar clr = cv::Scalar(0, 0, 255);
|
||||
cv::Scalar header_clr = cv::Scalar(255, 0, 0);
|
||||
|
||||
for (auto & face_id_pair : faces)
|
||||
|
@ -265,6 +286,13 @@ public:
|
|||
|
||||
cv::putText(img, strAngles, cv::Point(br.x, padding += spacing), font, font_size, clr);
|
||||
|
||||
cv::putText(img, "EMOJIS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr);
|
||||
|
||||
cv::putText(img, "dominantEmoji: " + affdex::EmojiToString(f.emojis.dominantEmoji),
|
||||
cv::Point(br.x, padding += spacing), font, font_size, clr);
|
||||
|
||||
drawValues((float *)&f.emojis, emojis, br.x, padding, clr, img);
|
||||
|
||||
cv::putText(img, "EXPRESSIONS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr);
|
||||
|
||||
drawValues((float *)&f.expressions, expressions, br.x, padding, clr, img);
|
||||
|
|
|
@ -126,6 +126,7 @@ int main(int argsc, char ** argsv)
|
|||
//Initialize detectors
|
||||
frameDetector->setDetectAllEmotions(true);
|
||||
frameDetector->setDetectAllExpressions(true);
|
||||
frameDetector->setDetectAllEmojis(true);
|
||||
frameDetector->setDetectGender(true);
|
||||
frameDetector->setDetectGlasses(true);
|
||||
frameDetector->setClassifierPath(DATA_FOLDER);
|
||||
|
|
|
@ -123,6 +123,7 @@ int main(int argsc, char ** argsv)
|
|||
//Activate all the detectors
|
||||
videoDetector.setDetectAllEmotions(true);
|
||||
videoDetector.setDetectAllExpressions(true);
|
||||
videoDetector.setDetectAllEmojis(true);
|
||||
videoDetector.setDetectGender(true);
|
||||
videoDetector.setDetectGlasses(true);
|
||||
//Set the location of the data folder and license file
|
||||
|
|
Loading…
Reference in a new issue