More work towards GUI with new interface.
This commit is contained in:
parent
07dadf6600
commit
5f500117e2
4 changed files with 28 additions and 12 deletions
|
@ -85,7 +85,6 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
// Some members for displaying the results
|
// Some members for displaying the results
|
||||||
private Capture capture;
|
private Capture capture;
|
||||||
private FaceDetector face_detector;
|
|
||||||
private WriteableBitmap latest_img;
|
private WriteableBitmap latest_img;
|
||||||
private WriteableBitmap latest_aligned_face;
|
private WriteableBitmap latest_aligned_face;
|
||||||
private WriteableBitmap latest_HOG_descriptor;
|
private WriteableBitmap latest_HOG_descriptor;
|
||||||
|
@ -102,9 +101,13 @@ namespace OpenFaceOffline
|
||||||
volatile bool detectionSucceeding = false;
|
volatile bool detectionSucceeding = false;
|
||||||
|
|
||||||
// For tracking
|
// For tracking
|
||||||
|
private FaceDetector face_detector;
|
||||||
FaceModelParameters face_model_params;
|
FaceModelParameters face_model_params;
|
||||||
CLNF clnf_model;
|
CLNF clnf_model;
|
||||||
FaceAnalyserManaged face_analyser;
|
|
||||||
|
// For face analysis
|
||||||
|
FaceAnalyserManaged face_analyser_sequence;
|
||||||
|
FaceAnalyserManaged face_analyser_image;
|
||||||
GazeAnalyserManaged gaze_analyser;
|
GazeAnalyserManaged gaze_analyser;
|
||||||
|
|
||||||
// Recording parameters (default values)
|
// Recording parameters (default values)
|
||||||
|
@ -150,7 +153,8 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
face_model_params = new FaceModelParameters(root, false);
|
face_model_params = new FaceModelParameters(root, false);
|
||||||
clnf_model = new CLNF(face_model_params);
|
clnf_model = new CLNF(face_model_params);
|
||||||
face_analyser = new FaceAnalyserManaged(root, DynamicAUModels, image_output_size);
|
face_analyser_sequence = new FaceAnalyserManaged(root, true, image_output_size); // TODO how to deal with dynamic and static models here
|
||||||
|
face_analyser_image = new FaceAnalyserManaged(root, false, image_output_size);
|
||||||
|
|
||||||
gaze_analyser = new GazeAnalyserManaged();
|
gaze_analyser = new GazeAnalyserManaged();
|
||||||
|
|
||||||
|
@ -302,14 +306,17 @@ namespace OpenFaceOffline
|
||||||
List<double> confidences = new List<double>();
|
List<double> confidences = new List<double>();
|
||||||
face_detector.DetectFacesHOG(face_detections, grayFrame, confidences);
|
face_detector.DetectFacesHOG(face_detections, grayFrame, confidences);
|
||||||
|
|
||||||
//Rectangle
|
for (int i = 0; i < face_detections.Count; ++i)
|
||||||
var landmark_detections = clnf_model.DetectMultiFaceLandmarksInImage(grayFrame, face_model_params);
|
|
||||||
|
|
||||||
// Go over all detected faces
|
|
||||||
for (int i = 0; i < landmark_detections.Count; ++i)
|
|
||||||
{
|
{
|
||||||
|
bool success = clnf_model.DetectFaceLandmarksInImage(grayFrame, face_model_params);
|
||||||
|
|
||||||
// Predict action units
|
// Predict action units
|
||||||
var au_preds = face_analyser.PredictStaticAUs(grayFrame, landmark_detections[i]);
|
// TODO face analyser should be optimized for single images
|
||||||
|
var au_preds = face_analyser.PredictStaticAUs(grayFrame, clnf_model.CalculateAllLandmarks());
|
||||||
|
|
||||||
|
// Predic eye gaze
|
||||||
|
gaze_analyser.AddNextFrame(clnf_model, success, fx, fy, cx, cy); // TODO fx should be from reader
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Point> landmark_points = new List<Point>();
|
List<Point> landmark_points = new List<Point>();
|
||||||
|
|
|
@ -102,6 +102,12 @@ public:
|
||||||
{
|
{
|
||||||
string root_std = msclr::interop::marshal_as<std::string>(root);
|
string root_std = msclr::interop::marshal_as<std::string>(root);
|
||||||
FaceAnalysis::FaceAnalyserParameters params(root_std);
|
FaceAnalysis::FaceAnalyserParameters params(root_std);
|
||||||
|
|
||||||
|
if (!dynamic)
|
||||||
|
{
|
||||||
|
params.OptimizeForImages();
|
||||||
|
}
|
||||||
|
|
||||||
params.setAlignedOutput(output_width);
|
params.setAlignedOutput(output_width);
|
||||||
face_analyser = new FaceAnalysis::FaceAnalyser(params);
|
face_analyser = new FaceAnalysis::FaceAnalyser(params);
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ namespace CppInterop {
|
||||||
return ::LandmarkDetector::DetectLandmarksInImage(image->Mat, *clnf, *modelParams->getParams());
|
return ::LandmarkDetector::DetectLandmarksInImage(image->Mat, *clnf, *modelParams->getParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO rem old
|
||||||
List<List<System::Tuple<double,double>^>^>^ DetectMultiFaceLandmarksInImage(OpenCVWrappers::RawImage^ image, FaceModelParameters^ modelParams) {
|
List<List<System::Tuple<double,double>^>^>^ DetectMultiFaceLandmarksInImage(OpenCVWrappers::RawImage^ image, FaceModelParameters^ modelParams) {
|
||||||
|
|
||||||
auto all_landmarks = gcnew List<List<System::Tuple<double,double>^>^>();
|
auto all_landmarks = gcnew List<List<System::Tuple<double,double>^>^>();
|
||||||
|
|
|
@ -68,7 +68,6 @@ bool ImageCapture::Open(std::vector<std::string>& arguments)
|
||||||
// Some default values
|
// Some default values
|
||||||
std::string input_root = "";
|
std::string input_root = "";
|
||||||
fx = -1; fy = -1; cx = -1; cy = -1;
|
fx = -1; fy = -1; cx = -1; cy = -1;
|
||||||
frame_num = 0;
|
|
||||||
|
|
||||||
std::string separator = std::string(1, boost::filesystem::path::preferred_separator);
|
std::string separator = std::string(1, boost::filesystem::path::preferred_separator);
|
||||||
|
|
||||||
|
@ -179,7 +178,8 @@ bool ImageCapture::Open(std::vector<std::string>& arguments)
|
||||||
|
|
||||||
bool ImageCapture::OpenImageFiles(const std::vector<std::string>& image_files, float fx, float fy, float cx, float cy)
|
bool ImageCapture::OpenImageFiles(const std::vector<std::string>& image_files, float fx, float fy, float cx, float cy)
|
||||||
{
|
{
|
||||||
|
// Setting some defaults
|
||||||
|
frame_num = 0;
|
||||||
no_input_specified = false;
|
no_input_specified = false;
|
||||||
|
|
||||||
latest_frame = cv::Mat();
|
latest_frame = cv::Mat();
|
||||||
|
@ -218,6 +218,8 @@ bool ImageCapture::OpenDirectory(std::string directory, std::string bbox_directo
|
||||||
{
|
{
|
||||||
INFO_STREAM("Attempting to read from directory: " << directory);
|
INFO_STREAM("Attempting to read from directory: " << directory);
|
||||||
|
|
||||||
|
// Setup some defaults
|
||||||
|
frame_num = 0;
|
||||||
no_input_specified = false;
|
no_input_specified = false;
|
||||||
|
|
||||||
image_files.clear();
|
image_files.clear();
|
||||||
|
|
Loading…
Reference in a new issue