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> expressions;
|
||||||
std::vector<std::string> emotions;
|
std::vector<std::string> emotions;
|
||||||
|
std::vector<std::string> emojis;
|
||||||
std::vector<std::string> headAngles;
|
std::vector<std::string> headAngles;
|
||||||
|
|
||||||
std::map<affdex::Glasses, std::string> glassesMap;
|
std::map<affdex::Glasses, std::string> glassesMap;
|
||||||
|
@ -67,6 +68,15 @@ public:
|
||||||
|
|
||||||
headAngles = { "pitch", "yaw", "roll" };
|
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> {
|
genderMap = std::map<affdex::Gender, std::string> {
|
||||||
{ affdex::Gender::Male, "male" },
|
{ affdex::Gender::Male, "male" },
|
||||||
{ affdex::Gender::Female, "female" },
|
{ affdex::Gender::Female, "female" },
|
||||||
|
@ -79,10 +89,11 @@ public:
|
||||||
{ affdex::Glasses::No, "no glasses" }
|
{ 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 angle : headAngles) fStream << angle << ",";
|
||||||
for (std::string emotion : emotions) fStream << emotion << ",";
|
for (std::string emotion : emotions) fStream << emotion << ",";
|
||||||
for (std::string expression : expressions) fStream << expression << ",";
|
for (std::string expression : expressions) fStream << expression << ",";
|
||||||
|
for (std::string emoji : emojis) fStream << emoji << ",";
|
||||||
fStream << std::endl;
|
fStream << std::endl;
|
||||||
fStream.precision(4);
|
fStream.precision(4);
|
||||||
fStream << std::fixed;
|
fStream << std::fixed;
|
||||||
|
@ -162,10 +173,11 @@ public:
|
||||||
{
|
{
|
||||||
if (faces.empty())
|
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 angle : headAngles) fStream << "nan,";
|
||||||
for (std::string emotion : emotions) fStream << "nan,";
|
for (std::string emotion : emotions) fStream << "nan,";
|
||||||
for (std::string expression : expressions) fStream << "nan,";
|
for (std::string expression : expressions) fStream << "nan,";
|
||||||
|
for (std::string emoji : emojis) fStream << "nan,";
|
||||||
fStream << std::endl;
|
fStream << std::endl;
|
||||||
}
|
}
|
||||||
for (auto & face_id_pair : faces)
|
for (auto & face_id_pair : faces)
|
||||||
|
@ -176,7 +188,8 @@ public:
|
||||||
<< f.id << ","
|
<< f.id << ","
|
||||||
<< f.measurements.interocularDistance << ","
|
<< f.measurements.interocularDistance << ","
|
||||||
<< glassesMap[f.appearance.glasses] << ","
|
<< glassesMap[f.appearance.glasses] << ","
|
||||||
<< genderMap[f.appearance.gender] << ",";
|
<< genderMap[f.appearance.gender] << ","
|
||||||
|
<< affdex::EmojiToString(f.emojis.dominantEmoji) << ",";
|
||||||
|
|
||||||
float *values = (float *)&f.measurements.orientation;
|
float *values = (float *)&f.measurements.orientation;
|
||||||
for (std::string angle : headAngles)
|
for (std::string angle : headAngles)
|
||||||
|
@ -198,6 +211,14 @@ public:
|
||||||
fStream << (*values) << ",";
|
fStream << (*values) << ",";
|
||||||
values++;
|
values++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
values = (float *)&f.emojis;
|
||||||
|
for (std::string emoji : emojis)
|
||||||
|
{
|
||||||
|
fStream << (*values) << ",";
|
||||||
|
values++;
|
||||||
|
}
|
||||||
|
|
||||||
fStream << std::endl;
|
fStream << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +247,7 @@ public:
|
||||||
const int left_margin = 30;
|
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);
|
cv::Scalar header_clr = cv::Scalar(255, 0, 0);
|
||||||
|
|
||||||
for (auto & face_id_pair : faces)
|
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, 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);
|
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);
|
drawValues((float *)&f.expressions, expressions, br.x, padding, clr, img);
|
||||||
|
|
|
@ -126,6 +126,7 @@ int main(int argsc, char ** argsv)
|
||||||
//Initialize detectors
|
//Initialize detectors
|
||||||
frameDetector->setDetectAllEmotions(true);
|
frameDetector->setDetectAllEmotions(true);
|
||||||
frameDetector->setDetectAllExpressions(true);
|
frameDetector->setDetectAllExpressions(true);
|
||||||
|
frameDetector->setDetectAllEmojis(true);
|
||||||
frameDetector->setDetectGender(true);
|
frameDetector->setDetectGender(true);
|
||||||
frameDetector->setDetectGlasses(true);
|
frameDetector->setDetectGlasses(true);
|
||||||
frameDetector->setClassifierPath(DATA_FOLDER);
|
frameDetector->setClassifierPath(DATA_FOLDER);
|
||||||
|
|
|
@ -123,6 +123,7 @@ int main(int argsc, char ** argsv)
|
||||||
//Activate all the detectors
|
//Activate all the detectors
|
||||||
videoDetector.setDetectAllEmotions(true);
|
videoDetector.setDetectAllEmotions(true);
|
||||||
videoDetector.setDetectAllExpressions(true);
|
videoDetector.setDetectAllExpressions(true);
|
||||||
|
videoDetector.setDetectAllEmojis(true);
|
||||||
videoDetector.setDetectGender(true);
|
videoDetector.setDetectGender(true);
|
||||||
videoDetector.setDetectGlasses(true);
|
videoDetector.setDetectGlasses(true);
|
||||||
//Set the location of the data folder and license file
|
//Set the location of the data folder and license file
|
||||||
|
|
Loading…
Reference in a new issue