SDK-664: Updating the sample apps with x64 (#9)

* SDK-664: Updating the sample apps with x64
* Adding the yml for configuration
* Updating the travis yml
* Updating the project files to remove duplicate entries of x64
* Updating the configurations
* Updating the yml to publish the Artifacts and rebasing master
* Updating the verbosity of yml
* Fix enum definition of ethinicity to the latest build changes
* Adding the new AU's
* Updating the README to indicate that the app supports x64
* Update linux SDK link to 3.1-396
This commit is contained in:
Umang Mehta 2016-07-14 15:50:07 -04:00 committed by Abdelrahman Mahmoud
parent 17da41f5dd
commit b38fd876b2
10 changed files with 394 additions and 361 deletions

View file

@ -4,7 +4,7 @@ compiler:
- gcc-4.8 - gcc-4.8
before_script: before_script:
- sudo apt-get install -y gcc-4.8 g++-4.8 libopencv-dev libboost1.55-all-dev cmake - sudo apt-get install -y gcc-4.8 g++-4.8 libopencv-dev libboost1.55-all-dev cmake
- wget http://affdex-sdk-dist.s3-website-us-east-1.amazonaws.com/linux/download_sdk.html -O /tmp/affdex-sdk.tar.gz - wget https://download.affectiva.com/linux/affdex-cpp-sdk-3.1-396-linux-64bit.tar.gz -O /tmp/affdex-sdk.tar.gz
- mkdir /tmp/affdex-sdk - mkdir /tmp/affdex-sdk
- tar -xzvf /tmp/affdex-sdk.tar.gz -C /tmp/affdex-sdk - tar -xzvf /tmp/affdex-sdk.tar.gz -C /tmp/affdex-sdk
- mkdir build - mkdir build

View file

@ -1,6 +1,6 @@
#Sample Apps for Affdex SDK for Windows and Linux #Sample Apps for Affdex SDK for Windows and Linux
Welcome to our repository on GitHub! Here you will find example code to get you started with our Affdex SDK 3.0 and begin emotion-enabling you own app! Documentation for the SDKs is available on the <a href=http://developer.affectiva.com/>Affectiva's Developer Portal</a>. Welcome to our repository on GitHub! Here you will find example code to get you started with our Affdex SDK 3.1 and begin emotion-enabling you own app! Documentation for the SDKs is available on the <a href=http://developer.affectiva.com/>Affectiva's Developer Portal</a>.
*Build Status* *Build Status*
- Windows: [![Build status](https://ci.appveyor.com/api/projects/status/pn2y9h8a3nnkiw41?svg=true)] - Windows: [![Build status](https://ci.appveyor.com/api/projects/status/pn2y9h8a3nnkiw41?svg=true)]
@ -11,7 +11,7 @@ Dependencies
------------ ------------
*Windows* *Windows*
- Affdex SDK 3.0 (32 bit) - Affdex SDK 3.1 (64 bit)
- Visual Studio 2013 or higher - Visual Studio 2013 or higher
*Linux* *Linux*

View file

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013 # Visual Studio 2013
VisualStudioVersion = 12.0.21005.1 VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opencv-webcam-demo", "opencv-webcam-demo\opencv-webcam-demo.vcxproj", "{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opencv-webcam-demo", "opencv-webcam-demo\opencv-webcam-demo.vcxproj", "{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}"
EndProject EndProject
@ -9,23 +9,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video-demo", "video-demo\vi
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|Mixed Platforms = Release|Mixed Platforms Release|x64 = Release|x64
Release|Win32 = Release|Win32
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}.Release|x64.ActiveCfg = Release|x64
{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}.Release|Mixed Platforms.Build.0 = Release|Win32 {5D5E4401-09DE-40D3-9E29-AFC4F2EF2C80}.Release|x64.ActiveCfg = Release|x64
{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}.Release|Win32.ActiveCfg = Release|Win32
{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}.Release|Win32.Build.0 = Release|Win32
{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}.Release|x86.ActiveCfg = Release|Win32
{8DCDC209-C25D-4C61-B2AC-2FBA1775DD6B}.Release|x86.Build.0 = Release|Win32
{5D5E4401-09DE-40D3-9E29-AFC4F2EF2C80}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{5D5E4401-09DE-40D3-9E29-AFC4F2EF2C80}.Release|Mixed Platforms.Build.0 = Release|Win32
{5D5E4401-09DE-40D3-9E29-AFC4F2EF2C80}.Release|Win32.ActiveCfg = Release|Win32
{5D5E4401-09DE-40D3-9E29-AFC4F2EF2C80}.Release|Win32.Build.0 = Release|Win32
{5D5E4401-09DE-40D3-9E29-AFC4F2EF2C80}.Release|x86.ActiveCfg = Release|Win32
{5D5E4401-09DE-40D3-9E29-AFC4F2EF2C80}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

22
appveyor.yml Normal file
View file

@ -0,0 +1,22 @@
version: 1.0.{build}
image:
- Visual Studio 2013
- Visual Studio 2015
before_build:
- cmd: >-
appveyor DownloadFile http://affdex-sdk-dist.s3-website-us-east-1.amazonaws.com/windows/AffdexSDK-3.1-339-win64.exe -FileName AffdexSDK-win64.exe
AffdexSDK-win64.exe /S
nuget restore affdex-win-samples.sln
build:
parallel: true
verbosity: detailed
artifacts:
- path: '\x64\Release'
deploy:
- provider: GitHub
release: 3.1
auth_token:
secure: sjCE8t4b8ME8j2D6e0kRpNib8STOljgGVPdexj4n0gXU/nYxFkdaI9GXRukRHri5
artifact: Release.zip

View file

@ -1,315 +1,340 @@
#pragma once #pragma once
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <chrono> #include <chrono>
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include <fstream> #include <fstream>
#include <map> #include <map>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/timer/timer.hpp> #include <boost/timer/timer.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include "ImageListener.h" #include "ImageListener.h"
using namespace affdex; using namespace affdex;
class PlottingImageListener : public ImageListener class PlottingImageListener : public ImageListener
{ {
std::mutex mMutex; std::mutex mMutex;
std::deque<std::pair<Frame, std::map<FaceId, Face> > > mDataArray; std::deque<std::pair<Frame, std::map<FaceId, Face> > > mDataArray;
double mCaptureLastTS; double mCaptureLastTS;
double mCaptureFPS; double mCaptureFPS;
double mProcessLastTS; double mProcessLastTS;
double mProcessFPS; double mProcessFPS;
std::ofstream &fStream; std::ofstream &fStream;
std::chrono::time_point<std::chrono::system_clock> mStartT; std::chrono::time_point<std::chrono::system_clock> mStartT;
const bool mDrawDisplay; const bool mDrawDisplay;
const int spacing = 10; const int spacing = 10;
const float font_size = 0.5f; const float font_size = 0.5f;
const int font = cv::FONT_HERSHEY_COMPLEX_SMALL; const int font = cv::FONT_HERSHEY_COMPLEX_SMALL;
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> 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;
std::map<affdex::Gender, std::string> genderMap; std::map<affdex::Gender, std::string> genderMap;
std::map<affdex::Age, std::string> ageMap;
public: std::map<affdex::Ethnicity, std::string> ethnicityMap;
public:
PlottingImageListener(std::ofstream &csv, const bool draw_display)
: fStream(csv), mDrawDisplay(draw_display), mStartT(std::chrono::system_clock::now()),
mCaptureLastTS(-1.0f), mCaptureFPS(-1.0f), PlottingImageListener(std::ofstream &csv, const bool draw_display)
mProcessLastTS(-1.0f), mProcessFPS(-1.0f) : fStream(csv), mDrawDisplay(draw_display), mStartT(std::chrono::system_clock::now()),
{ mCaptureLastTS(-1.0f), mCaptureFPS(-1.0f),
expressions = { mProcessLastTS(-1.0f), mProcessFPS(-1.0f)
"smile", "innerBrowRaise", "browRaise", "browFurrow", "noseWrinkle", {
"upperLipRaise", "lipCornerDepressor", "chinRaise", "lipPucker", "lipPress", expressions = {
"lipSuck", "mouthOpen", "smirk", "eyeClosure", "attention" "smile", "innerBrowRaise", "browRaise", "browFurrow", "noseWrinkle",
}; "upperLipRaise", "lipCornerDepressor", "chinRaise", "lipPucker", "lipPress",
"lipSuck", "mouthOpen", "smirk", "eyeClosure", "attention", "eyeWiden", "cheekRaise",
emotions = { "lidTighten", "dimpler", "lipStretch", "jawDrop"
"joy", "fear", "disgust", "sadness", "anger", };
"surprise", "contempt", "valence", "engagement"
}; emotions = {
"joy", "fear", "disgust", "sadness", "anger",
headAngles = { "pitch", "yaw", "roll" }; "surprise", "contempt", "valence", "engagement"
};
emojis = std::vector<std::string> { headAngles = { "pitch", "yaw", "roll" };
"relaxed", "smiley", "laughing",
"kissing", "disappointed",
"rage", "smirk", "wink", emojis = std::vector<std::string> {
"stuckOutTongueWinkingEye", "stuckOutTongue", "relaxed", "smiley", "laughing",
"flushed", "scream" "kissing", "disappointed",
}; "rage", "smirk", "wink",
"stuckOutTongueWinkingEye", "stuckOutTongue",
genderMap = std::map<affdex::Gender, std::string> { "flushed", "scream"
{ affdex::Gender::Male, "male" }, };
{ affdex::Gender::Female, "female" },
{ affdex::Gender::Unknown, "unknown" }, genderMap = std::map<affdex::Gender, std::string> {
{ affdex::Gender::Male, "male" },
}; { affdex::Gender::Female, "female" },
{ affdex::Gender::Unknown, "unknown" },
glassesMap = std::map<affdex::Glasses, std::string> {
{ affdex::Glasses::Yes, "glasses" }, };
{ affdex::Glasses::No, "no glasses" }
}; glassesMap = std::map<affdex::Glasses, std::string> {
{ affdex::Glasses::Yes, "yes" },
fStream << "TimeStamp,faceId,interocularDistance,glasses,gender,dominantEmoji,"; { affdex::Glasses::No, "no" }
for (std::string angle : headAngles) fStream << angle << ","; };
for (std::string emotion : emotions) fStream << emotion << ",";
for (std::string expression : expressions) fStream << expression << ","; ageMap = std::map<affdex::Age, std::string> {
for (std::string emoji : emojis) fStream << emoji << ","; { affdex::Age::AGE_UNKNOWN, "unknown"},
fStream << std::endl; { affdex::Age::AGE_UNDER_18, "under 18" },
fStream.precision(4); { affdex::Age::AGE_18_24, "18-24" },
fStream << std::fixed; { affdex::Age::AGE_25_34, "25-34" },
} { affdex::Age::AGE_35_44, "35-44" },
{ affdex::Age::AGE_45_54, "45-54" },
FeaturePoint minPoint(VecFeaturePoint points) { affdex::Age::AGE_55_64, "55-64" },
{ { affdex::Age::AGE_65_PLUS, "65 plus" }
VecFeaturePoint::iterator it = points.begin(); };
FeaturePoint ret = *it;
for (; it != points.end(); it++) ethnicityMap = std::map<affdex::Ethnicity, std::string> {
{ { affdex::Ethnicity::UNKNOWN, "unknown"},
if (it->x < ret.x) ret.x = it->x; { affdex::Ethnicity::CAUCASIAN, "caucasian" },
if (it->y < ret.y) ret.y = it->y; { affdex::Ethnicity::BLACK_AFRICAN, "black african" },
} { affdex::Ethnicity::SOUTH_ASIAN, "south asian" },
return ret; { affdex::Ethnicity::EAST_ASIAN, "east asian" },
}; { affdex::Ethnicity::HISPANIC, "hispanic" }
};
FeaturePoint maxPoint( VecFeaturePoint points)
{ fStream << "TimeStamp,faceId,interocularDistance,glasses,age,ethnicity,gender,dominantEmoji,";
VecFeaturePoint::iterator it = points.begin(); for (std::string angle : headAngles) fStream << angle << ",";
FeaturePoint ret = *it; for (std::string emotion : emotions) fStream << emotion << ",";
for (; it != points.end(); it++) for (std::string expression : expressions) fStream << expression << ",";
{ for (std::string emoji : emojis) fStream << emoji << ",";
if (it->x > ret.x) ret.x = it->x; fStream << std::endl;
if (it->y > ret.y) ret.y = it->y; fStream.precision(4);
} fStream << std::fixed;
return ret; }
};
FeaturePoint minPoint(VecFeaturePoint points)
{
double getProcessingFrameRate() VecFeaturePoint::iterator it = points.begin();
{ FeaturePoint ret = *it;
std::lock_guard<std::mutex> lg(mMutex); for (; it != points.end(); it++)
return mProcessFPS; {
} if (it->x < ret.x) ret.x = it->x;
if (it->y < ret.y) ret.y = it->y;
double getCaptureFrameRate() }
{ return ret;
std::lock_guard<std::mutex> lg(mMutex); };
return mCaptureFPS;
} FeaturePoint maxPoint(VecFeaturePoint points)
{
int getDataSize() VecFeaturePoint::iterator it = points.begin();
{ FeaturePoint ret = *it;
std::lock_guard<std::mutex> lg(mMutex); for (; it != points.end(); it++)
return mDataArray.size(); {
if (it->x > ret.x) ret.x = it->x;
} if (it->y > ret.y) ret.y = it->y;
}
std::pair<Frame, std::map<FaceId, Face>> getData() return ret;
{ };
std::lock_guard<std::mutex> lg(mMutex);
std::pair<Frame, std::map<FaceId, Face>> dpoint = mDataArray.front();
mDataArray.pop_front(); double getProcessingFrameRate()
return dpoint; {
} std::lock_guard<std::mutex> lg(mMutex);
return mProcessFPS;
void onImageResults(std::map<FaceId, Face> faces, Frame image) override }
{
std::lock_guard<std::mutex> lg(mMutex); double getCaptureFrameRate()
mDataArray.push_back(std::pair<Frame, std::map<FaceId, Face>> (image, faces) ); {
std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now(); std::lock_guard<std::mutex> lg(mMutex);
std::chrono::milliseconds milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now - mStartT); return mCaptureFPS;
double seconds = milliseconds.count() / 1000.f; }
mProcessFPS = 1.0f / (seconds - mProcessLastTS);
mProcessLastTS = seconds; int getDataSize()
}; {
std::lock_guard<std::mutex> lg(mMutex);
void onImageCapture(Frame image) override return mDataArray.size();
{
std::lock_guard<std::mutex> lg(mMutex); }
mCaptureFPS = 1.0f / (image.getTimestamp() - mCaptureLastTS);
mCaptureLastTS = image.getTimestamp(); std::pair<Frame, std::map<FaceId, Face>> getData()
}; {
std::lock_guard<std::mutex> lg(mMutex);
void outputToFile(const std::map<FaceId, Face> faces, const double timeStamp) std::pair<Frame, std::map<FaceId, Face>> dpoint = mDataArray.front();
{ mDataArray.pop_front();
if (faces.empty()) return dpoint;
{ }
fStream << timeStamp << "nan,nan,no glasses,unknown, unknown,";
for (std::string angle : headAngles) fStream << "nan,"; void onImageResults(std::map<FaceId, Face> faces, Frame image) override
for (std::string emotion : emotions) fStream << "nan,"; {
for (std::string expression : expressions) fStream << "nan,"; std::lock_guard<std::mutex> lg(mMutex);
for (std::string emoji : emojis) fStream << "nan,"; mDataArray.push_back(std::pair<Frame, std::map<FaceId, Face>>(image, faces));
fStream << std::endl; std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
} std::chrono::milliseconds milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now - mStartT);
for (auto & face_id_pair : faces) double seconds = milliseconds.count() / 1000.f;
{ mProcessFPS = 1.0f / (seconds - mProcessLastTS);
Face f = face_id_pair.second; mProcessLastTS = seconds;
};
fStream << timeStamp << ","
<< f.id << "," void onImageCapture(Frame image) override
<< f.measurements.interocularDistance << "," {
<< glassesMap[f.appearance.glasses] << "," std::lock_guard<std::mutex> lg(mMutex);
<< genderMap[f.appearance.gender] << "," mCaptureFPS = 1.0f / (image.getTimestamp() - mCaptureLastTS);
<< affdex::EmojiToString(f.emojis.dominantEmoji) << ","; mCaptureLastTS = image.getTimestamp();
};
float *values = (float *)&f.measurements.orientation;
for (std::string angle : headAngles) void outputToFile(const std::map<FaceId, Face> faces, const double timeStamp)
{ {
fStream << (*values) << ","; if (faces.empty())
values++; {
} fStream << timeStamp << "nan,nan,no,unknown,unknown,unknown,unknown,";
for (std::string angle : headAngles) fStream << "nan,";
values = (float *)&f.emotions; for (std::string emotion : emotions) fStream << "nan,";
for (std::string emotion : emotions) for (std::string expression : expressions) fStream << "nan,";
{ for (std::string emoji : emojis) fStream << "nan,";
fStream << (*values) << ","; fStream << std::endl;
values++; }
} for (auto & face_id_pair : faces)
{
values = (float *)&f.expressions; Face f = face_id_pair.second;
for (std::string expression : expressions)
{ fStream << timeStamp << ","
fStream << (*values) << ","; << f.id << ","
values++; << f.measurements.interocularDistance << ","
} << glassesMap[f.appearance.glasses] << ","
<< ageMap[f.appearance.age] << ","
values = (float *)&f.emojis; << ethnicityMap[f.appearance.ethnicity] << ","
for (std::string emoji : emojis) << genderMap[f.appearance.gender] << ","
{ << affdex::EmojiToString(f.emojis.dominantEmoji) << ",";
fStream << (*values) << ",";
values++; float *values = (float *)&f.measurements.orientation;
} for (std::string angle : headAngles)
{
fStream << std::endl; fStream << (*values) << ",";
} values++;
} }
void drawValues(const float * first, const std::vector<std::string> names, values = (float *)&f.emotions;
const int x, int &padding, const cv::Scalar clr, for (std::string emotion : emotions)
cv::Mat img) {
{ fStream << (*values) << ",";
for (std::string name : names) values++;
{ }
if (std::abs(*first) > 5.0f)
{ values = (float *)&f.expressions;
char m[50]; for (std::string expression : expressions)
sprintf(m, "%s: %3.2f", name.c_str(), (*first)); {
cv::putText(img, m, cv::Point(x, padding += spacing), font, font_size, clr); fStream << (*values) << ",";
} values++;
first++; }
}
} values = (float *)&f.emojis;
for (std::string emoji : emojis)
void draw(const std::map<FaceId, Face> faces, Frame image) {
{ fStream << (*values) << ",";
std::shared_ptr<byte> imgdata = image.getBGRByteArray(); values++;
cv::Mat img = cv::Mat(image.getHeight(), image.getWidth(), CV_8UC3, imgdata.get()); }
const int left_margin = 30; fStream << std::endl;
}
}
cv::Scalar clr = cv::Scalar(0, 0, 255);
cv::Scalar header_clr = cv::Scalar(255, 0, 0); void drawValues(const float * first, const std::vector<std::string> names,
const int x, int &padding, const cv::Scalar clr,
for (auto & face_id_pair : faces) cv::Mat img)
{ {
Face f = face_id_pair.second; for (std::string name : names)
VecFeaturePoint points = f.featurePoints; {
for (auto& point : points) //Draw face feature points. if (std::abs(*first) > 5.0f)
{ {
cv::circle(img, cv::Point(point.x, point.y), 2.0f, cv::Scalar(0, 0, 255)); char m[50];
} sprintf(m, "%s: %3.2f", name.c_str(), (*first));
FeaturePoint tl = minPoint(points); cv::putText(img, m, cv::Point(x, padding += spacing), font, font_size, clr);
FeaturePoint br = maxPoint(points); }
first++;
//Output the results of the different classifiers. }
int padding = tl.y + 10; }
cv::putText(img, "APPEARANCE", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr); void draw(const std::map<FaceId, Face> faces, Frame image)
cv::putText(img, genderMap[f.appearance.gender], cv::Point(br.x, padding += spacing), font, font_size, clr); {
cv::putText(img, glassesMap[f.appearance.glasses], cv::Point(br.x, padding += spacing), font, font_size, clr); std::shared_ptr<byte> imgdata = image.getBGRByteArray();
cv::Mat img = cv::Mat(image.getHeight(), image.getWidth(), CV_8UC3, imgdata.get());
const int left_margin = 30;
Orientation headAngles = f.measurements.orientation;
char strAngles[100]; cv::Scalar clr = cv::Scalar(0, 0, 255);
sprintf(strAngles, "Pitch: %3.2f Yaw: %3.2f Roll: %3.2f Interocular: %3.2f", cv::Scalar header_clr = cv::Scalar(255, 0, 0);
headAngles.pitch, headAngles.yaw, headAngles.roll, f.measurements.interocularDistance);
for (auto & face_id_pair : faces)
{
Face f = face_id_pair.second;
char fId[10]; VecFeaturePoint points = f.featurePoints;
sprintf(fId, "ID: %i", f.id); for (auto& point : points) //Draw face feature points.
cv::putText(img, fId, cv::Point(br.x, padding += spacing), font, font_size, clr); {
cv::circle(img, cv::Point(point.x, point.y), 2.0f, cv::Scalar(0, 0, 255));
cv::putText(img, "MEASUREMENTS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr); }
FeaturePoint tl = minPoint(points);
cv::putText(img, strAngles, cv::Point(br.x, padding += spacing), font, font_size, clr); FeaturePoint br = maxPoint(points);
cv::putText(img, "EMOJIS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr); //Output the results of the different classifiers.
int padding = tl.y + 10;
cv::putText(img, "dominantEmoji: " + affdex::EmojiToString(f.emojis.dominantEmoji),
cv::Point(br.x, padding += spacing), font, font_size, clr); cv::putText(img, "APPEARANCE", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr);
cv::putText(img, genderMap[f.appearance.gender], cv::Point(br.x, padding += spacing), font, font_size, clr);
drawValues((float *)&f.emojis, emojis, br.x, padding, clr, img); cv::putText(img, glassesMap[f.appearance.glasses], cv::Point(br.x, padding += spacing), font, font_size, clr);
cv::putText(img, ageMap[f.appearance.age], cv::Point(br.x, padding += spacing), font, font_size, clr);
cv::putText(img, "EXPRESSIONS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr); cv::putText(img, ethnicityMap[f.appearance.ethnicity], cv::Point(br.x, padding += spacing), font, font_size, clr);
drawValues((float *)&f.expressions, expressions, br.x, padding, clr, img); Orientation headAngles = f.measurements.orientation;
cv::putText(img, "EMOTIONS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr); char strAngles[100];
sprintf(strAngles, "Pitch: %3.2f Yaw: %3.2f Roll: %3.2f Interocular: %3.2f",
drawValues((float *)&f.emotions, emotions, br.x, padding, clr, img); headAngles.pitch, headAngles.yaw, headAngles.roll, f.measurements.interocularDistance);
}
char fps_str[50];
sprintf(fps_str, "capture fps: %2.0f", mCaptureFPS); char fId[10];
cv::putText(img, fps_str, cv::Point(img.cols - 110, img.rows - left_margin - spacing), font, font_size, clr); sprintf(fId, "ID: %i", f.id);
sprintf(fps_str, "process fps: %2.0f", mProcessFPS); cv::putText(img, fId, cv::Point(br.x, padding += spacing), font, font_size, clr);
cv::putText(img, fps_str, cv::Point(img.cols - 110, img.rows - left_margin), font, font_size, clr);
cv::putText(img, "MEASUREMENTS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr);
cv::imshow("analyze video", img);
cv::waitKey(5); 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);
cv::putText(img, "EMOTIONS", cv::Point(br.x, padding += (spacing * 2)), font, font_size, header_clr);
drawValues((float *)&f.emotions, emotions, br.x, padding, clr, img);
}
char fps_str[50];
sprintf(fps_str, "capture fps: %2.0f", mCaptureFPS);
cv::putText(img, fps_str, cv::Point(img.cols - 110, img.rows - left_margin - spacing), font, font_size, clr);
sprintf(fps_str, "process fps: %2.0f", mProcessFPS);
cv::putText(img, fps_str, cv::Point(img.cols - 110, img.rows - left_margin), font, font_size, clr);
cv::imshow("analyze video", img);
cv::waitKey(30);
}
};

View file

@ -127,8 +127,7 @@ int main(int argsc, char ** argsv)
frameDetector->setDetectAllEmotions(true); frameDetector->setDetectAllEmotions(true);
frameDetector->setDetectAllExpressions(true); frameDetector->setDetectAllExpressions(true);
frameDetector->setDetectAllEmojis(true); frameDetector->setDetectAllEmojis(true);
frameDetector->setDetectGender(true); frameDetector->setDetectAllAppearances(true);
frameDetector->setDetectGlasses(true);
frameDetector->setClassifierPath(DATA_FOLDER); frameDetector->setClassifierPath(DATA_FOLDER);
frameDetector->setLicensePath(LICENSE_PATH); frameDetector->setLicensePath(LICENSE_PATH);
frameDetector->setImageListener(listenPtr.get()); frameDetector->setImageListener(listenPtr.get());

View file

@ -2,9 +2,9 @@
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCV.2.4.10\build\native\OpenCV.props" Condition="Exists('..\packages\OpenCV.2.4.10\build\native\OpenCV.props')" /> <Import Project="..\packages\OpenCV.2.4.10\build\native\OpenCV.props" Condition="Exists('..\packages\OpenCV.2.4.10\build\native\OpenCV.props')" />
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
@ -15,7 +15,7 @@
<RestorePackages>true</RestorePackages> <RestorePackages>true</RestorePackages>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
@ -25,16 +25,16 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros"> <PropertyGroup Label="UserMacros">
<NuGetPackageImportStamp>635eb584</NuGetPackageImportStamp> <NuGetPackageImportStamp>635eb584</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
@ -44,18 +44,18 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\Affectiva\Affdex SDK\include;../common/;%(AdditionalDependencies)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>C:\Program Files\Affectiva\Affdex SDK\include;../common/;%(AdditionalDependencies)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>C:\Program Files (x86)\Affectiva\Affdex SDK\lib\release\affdex-native.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>C:\Program Files\Affectiva\Affdex SDK\lib\release\affdex-native.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>xcopy /d /y "C:\Program Files (x86)\Affectiva\Affdex SDK\bin\release\affdex-native.dll" "$(OutDir)" <Command>xcopy /d /y "C:\Program Files\Affectiva\Affdex SDK\bin\release\affdex-native.dll" "$(OutDir)"
xcopy /d /s /y "C:\Program Files (x86)\Affectiva\Affdex SDK\data" "$(OutDir)data\"</Command> xcopy /d /s /y "C:\Program Files\Affectiva\Affdex SDK\data" "$(OutDir)data\"</Command>
</PostBuildEvent> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerEnvironment>PATH=%PATH%;C:\Program Files (x86)\Affectiva\Affdex SDK\bin\release\;C:\Program Files (x86)\Affectiva\Affdex SDK\bin</LocalDebuggerEnvironment> <LocalDebuggerEnvironment>PATH=%PATH%;C:\Program Files\Affectiva\Affdex SDK\bin\release\;C:\Program Files\Affectiva\Affdex SDK\bin</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -140,8 +140,7 @@ int main(int argsc, char ** argsv)
detector->setDetectAllEmotions(true); detector->setDetectAllEmotions(true);
detector->setDetectAllExpressions(true); detector->setDetectAllExpressions(true);
detector->setDetectAllEmojis(true); detector->setDetectAllEmojis(true);
detector->setDetectGender(true); detector->setDetectAllAppearances(true);
detector->setDetectGlasses(true);
detector->setClassifierPath(DATA_FOLDER); detector->setClassifierPath(DATA_FOLDER);
detector->setLicensePath(LICENSE_PATH); detector->setLicensePath(LICENSE_PATH);
detector->setImageListener(listenPtr.get()); detector->setImageListener(listenPtr.get());

View file

@ -2,9 +2,9 @@
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCV.2.4.10\build\native\OpenCV.props" Condition="Exists('..\packages\OpenCV.2.4.10\build\native\OpenCV.props')" /> <Import Project="..\packages\OpenCV.2.4.10\build\native\OpenCV.props" Condition="Exists('..\packages\OpenCV.2.4.10\build\native\OpenCV.props')" />
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
@ -15,7 +15,7 @@
<RestorePackages>true</RestorePackages> <RestorePackages>true</RestorePackages>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
@ -25,16 +25,16 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros"> <PropertyGroup Label="UserMacros">
<NuGetPackageImportStamp>5c6c3308</NuGetPackageImportStamp> <NuGetPackageImportStamp>5c6c3308</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
@ -44,19 +44,19 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\Affectiva\Affdex SDK\include;../common;%(AdditionalDependencies)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>C:\Program Files\Affectiva\Affdex SDK\include;../common;%(AdditionalDependencies)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>C:\Program Files (x86)\Affectiva\Affdex SDK\lib\release\affdex-native.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>C:\Program Files\Affectiva\Affdex SDK\lib\release\affdex-native.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>xcopy /d /y "C:\Program Files (x86)\Affectiva\Affdex SDK\bin\release\affdex-native.dll" "$(OutDir)" <Command>xcopy /d /y "C:\Program Files\Affectiva\Affdex SDK\bin\release\affdex-native.dll" "$(OutDir)"
xcopy /d /y "C:\Program Files (x86)\Affectiva\Affdex SDK\bin\opencv_ffmpeg248.dll" "$(OutDir)" xcopy /d /y "C:\Program Files\Affectiva\Affdex SDK\bin\opencv_ffmpeg248_64.dll" "$(OutDir)"
xcopy /d /s /y "C:\Program Files (x86)\Affectiva\Affdex SDK\data" "$(OutDir)data\"</Command> xcopy /d /s /y "C:\Program Files\Affectiva\Affdex SDK\data" "$(OutDir)data\"</Command>
</PostBuildEvent> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>