Merge pull request #3 from Affectiva/opencv-app-update

update the C++ sample app w/sdk release changes
This commit is contained in:
Jay Turcot 2015-04-21 17:45:26 -04:00
commit aa56f9054c
3 changed files with 15 additions and 20 deletions

View file

@ -12,7 +12,7 @@
#include "AffdexException.h"
using namespace std;
using namespace AFFDEX;
using namespace affdex;
float last_timestamp = -1.0f;
float capture_fps = -1.0f;
@ -23,7 +23,7 @@ float process_fps = -1.0f;
class PlottingImageListener : public ImageListener
{
public:
void onImageResults(vector<Face> faces, Frame image) override {
void onImageResults(std::map<FaceId,Face> faces, Frame image) {
shared_ptr<byte> imgdata = image.getBGRByteArray();
cv::Mat img = cv::Mat(image.getHeight(), image.getWidth(), CV_8UC3, imgdata.get());
@ -70,25 +70,12 @@ int main(int argsc, char ** argsv)
try{
// Parse and check the data folder (with assets)
std::wstring DATA_FOLDER = L"data";
if (argsc > 1)
{
std::string user_folder(argsv[1]);
DATA_FOLDER.assign(user_folder.begin(), user_folder.end());
}
const std::wstring AFFDEX_DATA_DIR = L"C:\\Program Files (x86)\\Affectiva\\Affdex SDK\\data";
const std::wstring AFFDEX_LICENSE_FILE = L"affdex.license";
int framerate = 30;
int process_frame_rate = 30;
int buffer_length = 2;
if (argsc > 2)
{
framerate = stoi(argsv[2]);
}
if (argsc > 3)
{
process_frame_rate = stoi(argsv[3]);
}
FrameDetector frameDetector(buffer_length, process_frame_rate); // Init the FrameDetector Class
shared_ptr<ImageListener> listenPtr(new PlottingImageListener()); // Instanciate the ImageListener class
@ -110,7 +97,8 @@ int main(int argsc, char ** argsv)
frameDetector.setDetectLipCornerDepressor(true);
frameDetector.setDetectEngagement(true);
frameDetector.setDetectValence(true);
frameDetector.setClassifierPath(DATA_FOLDER);
frameDetector.setClassifierPath(AFFDEX_DATA_DIR);
frameDetector.setLicensePath(AFFDEX_LICENSE_FILE);
frameDetector.setImageListener(listenPtr.get());
//Start the frame detector thread.
frameDetector.start();

View file

@ -71,14 +71,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\affdex-sdk\include;..\opencv\build\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Program Files %28x86%29\Affectiva\Affdex SDK\include;..\opencv\build\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>..\affdex-sdk\lib\affdex-sdk.lib;..\opencv\build\x86\vc12\lib\opencv_highgui2411.lib;..\opencv\build\x86\vc12\lib\opencv_core2411.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 (x86)\Affectiva\Affdex SDK\lib\release\affdex-native.lib;..\opencv\build\x86\vc12\lib\opencv_highgui249.lib;..\opencv\build\x86\vc12\lib\opencv_core249.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>
</ItemDefinitionGroup>
<ItemGroup>

View file

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