Displaying eye-landmarks
This commit is contained in:
parent
a57fbdea7b
commit
ebf444a236
3 changed files with 43 additions and 2 deletions
|
@ -595,6 +595,7 @@ namespace OpenFaceOffline
|
||||||
{
|
{
|
||||||
video.OverlayLines.Clear();
|
video.OverlayLines.Clear();
|
||||||
video.OverlayPoints.Clear();
|
video.OverlayPoints.Clear();
|
||||||
|
video.OverlayEyePoints.Clear();
|
||||||
video.GazeLines.Clear();
|
video.GazeLines.Clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -607,8 +608,15 @@ namespace OpenFaceOffline
|
||||||
landmark_points.Add(new Point(p.Item1, p.Item2));
|
landmark_points.Add(new Point(p.Item1, p.Item2));
|
||||||
}
|
}
|
||||||
|
|
||||||
video.OverlayPoints = landmark_points;
|
List<Point> eye_landmark_points = new List<Point>();
|
||||||
|
foreach (var p in eye_landmarks)
|
||||||
|
{
|
||||||
|
eye_landmark_points.Add(new Point(p.Item1, p.Item2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
video.OverlayPoints = landmark_points;
|
||||||
|
video.OverlayEyePoints = eye_landmark_points;
|
||||||
video.GazeLines = gaze_lines;
|
video.GazeLines = gaze_lines;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ namespace OpenFaceOffline
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
OverlayLines = new List<Tuple<Point, Point>>();
|
OverlayLines = new List<Tuple<Point, Point>>();
|
||||||
OverlayPoints = new List<Point>();
|
OverlayPoints = new List<Point>();
|
||||||
|
OverlayEyePoints = new List<Point>();
|
||||||
GazeLines = new List<Tuple<Point, Point>>();
|
GazeLines = new List<Tuple<Point, Point>>();
|
||||||
|
|
||||||
Progress = -1;
|
Progress = -1;
|
||||||
|
@ -90,6 +91,9 @@ namespace OpenFaceOffline
|
||||||
if (OverlayPoints == null)
|
if (OverlayPoints == null)
|
||||||
OverlayPoints = new List<Point>();
|
OverlayPoints = new List<Point>();
|
||||||
|
|
||||||
|
if (OverlayEyePoints == null)
|
||||||
|
OverlayEyePoints = new List<Point>();
|
||||||
|
|
||||||
if (Source == null || !(Source is WriteableBitmap))
|
if (Source == null || !(Source is WriteableBitmap))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -120,7 +124,34 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
var q = new Point(ActualWidth * p.X / width, ActualHeight * p.Y / height);
|
var q = new Point(ActualWidth * p.X / width, ActualHeight * p.Y / height);
|
||||||
|
|
||||||
dc.DrawEllipse(new SolidColorBrush(Color.FromArgb((byte)(200 * Confidence), 255, 255, 100)), null, q, 2, 2);
|
dc.DrawEllipse(new SolidColorBrush(Color.FromArgb((byte)(200 * Confidence), 255, 255, 100)), null, q, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int id = 0; id < OverlayEyePoints.Count; id++)
|
||||||
|
{
|
||||||
|
|
||||||
|
var q1 = new Point(ActualWidth * OverlayEyePoints[id].X / width, ActualHeight * OverlayEyePoints[id].Y / height);
|
||||||
|
|
||||||
|
int next_point = id + 1;
|
||||||
|
|
||||||
|
if (id == 7) next_point = 0;
|
||||||
|
if (id == 19) next_point = 8;
|
||||||
|
if (id == 27) next_point = 20;
|
||||||
|
|
||||||
|
if (id == 35) next_point = 28;
|
||||||
|
if (id == 47) next_point = 36;
|
||||||
|
if (id == 55) next_point = 48;
|
||||||
|
|
||||||
|
var q2 = new Point(ActualWidth * OverlayEyePoints[next_point].X / width, ActualHeight * OverlayEyePoints[next_point].Y / height);
|
||||||
|
|
||||||
|
if (id < 28 && (id < 8 || id > 19) || (id>=28 &&(id-28<8 || id-28 >19)))
|
||||||
|
{
|
||||||
|
dc.DrawLine(new Pen(new SolidColorBrush(Color.FromArgb(200, (byte)(240), (byte)(30), (byte)100)), 1), q1, q2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dc.DrawLine(new Pen(new SolidColorBrush(Color.FromArgb(200, (byte)(100), (byte)(30), (byte)240)), 1), q1, q2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double scaling = ActualWidth / 400.0;
|
double scaling = ActualWidth / 400.0;
|
||||||
|
@ -156,6 +187,7 @@ namespace OpenFaceOffline
|
||||||
public List<Tuple<Point, Point>> OverlayLines { get; set; }
|
public List<Tuple<Point, Point>> OverlayLines { get; set; }
|
||||||
public List<Tuple<Point, Point>> GazeLines { get; set; }
|
public List<Tuple<Point, Point>> GazeLines { get; set; }
|
||||||
public List<Point> OverlayPoints { get; set; }
|
public List<Point> OverlayPoints { get; set; }
|
||||||
|
public List<Point> OverlayEyePoints { get; set; }
|
||||||
public double Confidence { get; set; }
|
public double Confidence { get; set; }
|
||||||
public double FPS { get; set; }
|
public double FPS { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,7 @@ namespace LandmarkDetector
|
||||||
|
|
||||||
vector<cv::Point2d> CalculateLandmarks(const cv::Mat_<double>& shape2D, cv::Mat_<int>& visibilities);
|
vector<cv::Point2d> CalculateLandmarks(const cv::Mat_<double>& shape2D, cv::Mat_<int>& visibilities);
|
||||||
vector<cv::Point2d> CalculateLandmarks(CLNF& clnf_model);
|
vector<cv::Point2d> CalculateLandmarks(CLNF& clnf_model);
|
||||||
|
vector<cv::Point2d> CalculateEyeLandmarks(CLNF& clnf_model);
|
||||||
void DrawLandmarks(cv::Mat img, vector<cv::Point> landmarks);
|
void DrawLandmarks(cv::Mat img, vector<cv::Point> landmarks);
|
||||||
|
|
||||||
void Draw(cv::Mat img, const cv::Mat_<double>& shape2D, const cv::Mat_<int>& visibilities);
|
void Draw(cv::Mat img, const cv::Mat_<double>& shape2D, const cv::Mat_<int>& visibilities);
|
||||||
|
|
Loading…
Reference in a new issue