Gaze visualization changes.

This commit is contained in:
Tadas Baltrusaitis 2016-10-06 10:05:25 -04:00
parent 80210f267f
commit 05c7d4710c
2 changed files with 7 additions and 6 deletions

View file

@ -258,6 +258,7 @@ namespace OpenFaceDemo
List<double> pose = new List<double>();
clnf_model.GetCorrectedPoseCamera(pose, fx, fy, cx, cy);
List<double> non_rigid_params = clnf_model.GetNonRigidParams();
double scale = clnf_model.GetRigidParams()[0];
double time_stamp = (DateTime.Now - (DateTime)startTime).TotalMilliseconds;
// The face analysis step (only done if recording AUs, HOGs or video)
@ -274,7 +275,7 @@ namespace OpenFaceDemo
{
landmarks = clnf_model.CalculateLandmarks();
lines = clnf_model.CalculateBox((float)fx, (float)fy, (float)cx, (float)cy);
gaze_lines = face_analyser.CalculateGazeLines((float)fx, (float)fy, (float)cx, (float)cy);
gaze_lines = face_analyser.CalculateGazeLines(scale, (float)fx, (float)fy, (float)cx, (float)cy);
}
// Visualisation
@ -303,8 +304,8 @@ namespace OpenFaceDemo
browPlot.AddDataPoint(new DataPoint() { Time = CurrentTime, values = browDict, Confidence = confidence });
Dictionary<int, double> eyeDict = new Dictionary<int, double>();
eyeDict[0] = 0.5 * widen_cumm + 0.5 * eye_widen;
eyeDict[1] = 0.5 * wrinkle_cumm + 0.5 * nose_wrinkle;
eyeDict[0] = 0.7 * widen_cumm + 0.3 * eye_widen;
eyeDict[1] = 0.7 * wrinkle_cumm + 0.3 * nose_wrinkle;
eyePlot.AddDataPoint(new DataPoint() { Time = CurrentTime, values = eyeDict, Confidence = confidence });
smile_cumm = smileDict[0];

View file

@ -327,18 +327,18 @@ public:
}
System::Collections::Generic::List<System::Tuple<System::Windows::Point, System::Windows::Point>^>^ CalculateGazeLines(float fx, float fy, float cx, float cy)
System::Collections::Generic::List<System::Tuple<System::Windows::Point, System::Windows::Point>^>^ CalculateGazeLines(double scale, float fx, float fy, float cx, float cy)
{
cv::Mat_<double> cameraMat = (cv::Mat_<double>(3, 3) << fx, 0, cx, 0, fy, cy, 0, 0, 0);
vector<cv::Point3f> points_left;
points_left.push_back(cv::Point3f(*pupil_left));
points_left.push_back(cv::Point3f(*pupil_left + *gazeDirection0*40.0));
points_left.push_back(cv::Point3f(*pupil_left + *gazeDirection0 * 40.0 * scale));
vector<cv::Point3f> points_right;
points_right.push_back(cv::Point3f(*pupil_right));
points_right.push_back(cv::Point3f(*pupil_right + *gazeDirection1*40.0));
points_right.push_back(cv::Point3f(*pupil_right + *gazeDirection1 * 40.0 * scale));
// Perform manual projection of points
vector<cv::Point2d> imagePoints_left;