no message

This commit is contained in:
Tadas Baltrusaitis 2018-01-10 17:43:05 +00:00
parent 2c2ba97361
commit a13ebf2e4e
2 changed files with 31 additions and 48 deletions

View file

@ -249,21 +249,6 @@ namespace OpenFaceOffline
// Indicate we will start running the thread
thread_running = true;
// Turn off unneeded visualisations and recording settings (this will change)
// TODO controlled by recorder settings, also all features will be done
bool TrackVid = ShowTrackedVideo; ShowTrackedVideo = true;
bool ShowApp = ShowAppearance; ShowAppearance = false;
bool ShowGeo = ShowGeometry; ShowGeometry = false;
bool showAU = ShowAUs; ShowAUs = false;
bool recAlign = RecordAligned;
bool recHOG = RecordHOG;
// Actually update the GUI accordingly
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 2000), (Action)(() =>
{
VisualisationChange(null, null);
}));
// Setup the parameters optimized for working on individual images rather than sequences
face_model_params.optimiseForImages();
@ -309,11 +294,14 @@ namespace OpenFaceOffline
var landmarks = clnf_model.CalculateAllLandmarks();
// Predict action units
var au_preds = face_analyser.PredictStaticAUs(grayFrame, landmarks);
var au_preds = face_analyser.PredictStaticAUsAndComputeFeatures(grayFrame, landmarks);
// Predic eye gaze
gaze_analyser.AddNextFrame(clnf_model, success, fx, fy, cx, cy); // TODO fx should be from reader
// Only the final face will contain the details
VisualizeFeatures(frame, landmarks, fx, fy, cx, cy, progress);
foreach (var p in landmarks)
{
landmark_points.Add(new Point(p.Item1, p.Item2));
@ -322,47 +310,37 @@ namespace OpenFaceOffline
}
// Visualisation TODO this should be lifted out? and actually be grabbed from the visualizer? rather than drawing points ourselves?
if (ShowTrackedVideo)
{
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
{
if (latest_img == null)
{
latest_img = frame.CreateWriteableBitmap();
}
//if (ShowTrackedVideo)
//{
frame.UpdateWriteableBitmap(latest_img);
// Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
// {
// if (latest_img == null)
// {
// latest_img = frame.CreateWriteableBitmap();
// }
video.Source = latest_img;
video.Confidence = 1;
video.FPS = processing_fps.GetFPS();
video.Progress = progress;
// frame.UpdateWriteableBitmap(latest_img);
video.OverlayLines = new List<Tuple<Point, Point>>();
// video.Source = latest_img;
// video.Confidence = 1;
// video.FPS = processing_fps.GetFPS();
// video.Progress = progress;
video.OverlayPoints = landmark_points;
// video.OverlayLines = new List<Tuple<Point, Point>>();
}));
}
// video.OverlayPoints = landmark_points;
// // TODO unify with other visualization
// }));
//}
latest_img = null;
// TODO how to report errors from the reader here? exceptions? logging? Problem for future versions?
}
// Clear image setup, restore the views, TODO this will change
ShowTrackedVideo = TrackVid;
ShowAppearance = ShowApp;
ShowGeometry = ShowGeo;
ShowAUs = showAU;
RecordHOG = recHOG;
RecordAligned = recAlign;
// Actually update the GUI accordingly
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 2000), (Action)(() =>
{
VisualisationChange(null, null);
}));
// TODO is this still needed?
EndMode();
}

View file

@ -223,7 +223,7 @@ public:
// Predicting AUs from a single image
System::Tuple<Dictionary<System::String^, double>^, Dictionary<System::String^, double>^>^
PredictStaticAUs(OpenCVWrappers::RawImage^ frame, List<System::Tuple<double, double>^>^ landmarks)
PredictStaticAUsAndComputeFeatures(OpenCVWrappers::RawImage^ frame, List<System::Tuple<double, double>^>^ landmarks)
{
// Construct an OpenCV matric from the landmarks
@ -236,6 +236,11 @@ public:
face_analyser->PredictStaticAUsAndComputeFeatures(frame->Mat, landmarks_mat);
// Set the computed appearance features
face_analyser->GetLatestHOG(*hog_features, *num_rows, *num_cols);
face_analyser->GetLatestAlignedFace(*aligned_face);
// Set the computed AUs
auto AU_predictions_intensity = face_analyser->GetCurrentAUsReg();
auto AU_predictions_occurence = face_analyser->GetCurrentAUsClass();