Skip to content

Commit

Permalink
Getting rid of redundant parameters for head pose and eye gaze estima…
Browse files Browse the repository at this point in the history
…tion (a slight simplification).
  • Loading branch information
unknown authored and unknown committed Nov 3, 2015
1 parent c4c329e commit b8a5601
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions exe/FeatureExtraction/FeatureExtraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,8 @@ int main (int argc, char **argv)

if (clm_parameters.track_gaze)
{
FaceAnalysis::EstimateGaze(clm_model, clm_parameters, gazeDirection0, gazeDirection0_head, fx, fy, cx, cy, true);
FaceAnalysis::EstimateGaze(clm_model, clm_parameters, gazeDirection1, gazeDirection1_head, fx, fy, cx, cy, false);
FaceAnalysis::EstimateGaze(clm_model, gazeDirection0, gazeDirection0_head, fx, fy, cx, cy, true);
FaceAnalysis::EstimateGaze(clm_model, gazeDirection1, gazeDirection1_head, fx, fy, cx, cy, false);
}

// Do face alignment
Expand Down Expand Up @@ -809,11 +809,11 @@ int main (int argc, char **argv)
Vec6d pose_estimate_CLM;
if(use_camera_plane_pose)
{
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy, clm_parameters);
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy);
}
else
{
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCamera(clm_model, fx, fy, cx, cy, clm_parameters);
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCamera(clm_model, fx, fy, cx, cy);
}


Expand Down Expand Up @@ -872,7 +872,7 @@ int main (int argc, char **argv)
// A rough heuristic for box around the face width
int thickness = (int)std::ceil(2.0* ((double)captured_image.cols) / 640.0);

Vec6d pose_estimate_to_draw = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy, clm_parameters);
Vec6d pose_estimate_to_draw = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy);

// Draw it in reddish if uncertain, blueish if certain
CLMTracker::DrawBox(captured_image, pose_estimate_to_draw, Scalar((1 - vis_certainty)*255.0, 0, vis_certainty * 255), thickness, fx, fy, cx, cy);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>-rigid -verbose -f "../videos/default.wmv" -op "output_features/default_pose.txt" -of "output_features/default_fp.txt" -of3D "output_features/default_fp3D.txt" -simaligndir "output_features/aligned" -hogalign "output_features/default.hog" -oparams "output_features/default.params.txt" -oaus "output_features/aus.txt"</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-rigid -verbose -f "../videos/default.wmv" -op "output_features/default_pose.txt" -of "output_features/default_fp.txt" -of3D "output_features/default_fp3D.txt" -simaligndir "output_features/aligned" -hogalign "output_features/default.hog" -oparams "output_features/default.params.txt" -oaus "output_features/aus.txt" -ogaze "output_features/gaze.txt"</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion exe/MultiTrackCLM/MultiTrackCLM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ int main (int argc, char **argv)
int thickness = (int)std::ceil(2.0* ((double)captured_image.cols) / 640.0);

// Work out the pose of the head from the tracked model
Vec6d pose_estimate_CLM = CLMTracker::GetCorrectedPoseCameraPlane(clm_models[model], fx, fy, cx, cy, clm_parameters[model]);
Vec6d pose_estimate_CLM = CLMTracker::GetCorrectedPoseCameraPlane(clm_models[model], fx, fy, cx, cy);

// Draw it in reddish if uncertain, blueish if certain
CLMTracker::DrawBox(disp_image, pose_estimate_CLM, Scalar((1-detection_certainty)*255.0,0, detection_certainty*255), thickness, fx, fy, cx, cy);
Expand Down
6 changes: 3 additions & 3 deletions exe/SimpleCLM/SimpleCLM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ int main (int argc, char **argv)
Vec6d pose_estimate_CLM;
if(use_camera_plane_pose)
{
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy, clm_parameters);
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy);
}
else
{
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCamera(clm_model, fx, fy, cx, cy, clm_parameters);
pose_estimate_CLM = CLMTracker::GetCorrectedPoseCamera(clm_model, fx, fy, cx, cy);
}

// Visualising the results
Expand All @@ -282,7 +282,7 @@ int main (int argc, char **argv)
// A rough heuristic for box around the face width
int thickness = (int)std::ceil(2.0* ((double)captured_image.cols) / 640.0);

Vec6d pose_estimate_to_draw = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy, clm_parameters);
Vec6d pose_estimate_to_draw = CLMTracker::GetCorrectedPoseCameraPlane(clm_model, fx, fy, cx, cy);

// Draw it in reddish if uncertain, blueish if certain
CLMTracker::DrawBox(captured_image, pose_estimate_to_draw, Scalar((1-vis_certainty)*255.0,0, vis_certainty*255), thickness, fx, fy, cx, cy);
Expand Down
8 changes: 4 additions & 4 deletions lib/local/CLM/include/CLMTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ namespace CLMTracker

// The head pose returned is in camera space, however, the orientation can be either with respect to camera itself or the camera plane
// The format returned is [Tx, Ty, Tz, Eul_x, Eul_y, Eul_z]
Vec6d GetPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params);
Vec6d GetPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params);
Vec6d GetPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy);
Vec6d GetPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy);

// Getting a head pose estimate from the currently detected landmarks, with appropriate correction due to orthographic camera issue
// This is because rotation estimate under orthographic assumption is only correct close to the centre of the image
// These methods attempt to correct for that (Experimental)
// The format returned is [Tx, Ty, Tz, Eul_x, Eul_y, Eul_z]
Vec6d GetCorrectedPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params);
Vec6d GetCorrectedPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params);
Vec6d GetCorrectedPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy);
Vec6d GetCorrectedPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy);

//===========================================================================

Expand Down
8 changes: 4 additions & 4 deletions lib/local/CLM/src/CLMTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using namespace cv;

// Getting a head pose estimate from the currently detected landmarks (rotation with respect to camera)
// The format returned is [Tx, Ty, Tz, Eul_x, Eul_y, Eul_z]
Vec6d CLMTracker::GetPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params)
Vec6d CLMTracker::GetPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy)
{
if(!clm_model.detected_landmarks.empty() && clm_model.params_global[0] != 0)
{
Expand All @@ -74,7 +74,7 @@ Vec6d CLMTracker::GetPoseCamera(const CLM& clm_model, double fx, double fy, doub

// Getting a head pose estimate from the currently detected landmarks (rotation with respect to camera plane)
// The format returned is [Tx, Ty, Tz, Eul_x, Eul_y, Eul_z]
Vec6d CLMTracker::GetPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params)
Vec6d CLMTracker::GetPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy)
{
if(!clm_model.detected_landmarks.empty() && clm_model.params_global[0] != 0 && clm_model.tracking_initialised)
{
Expand Down Expand Up @@ -109,7 +109,7 @@ Vec6d CLMTracker::GetPoseCameraPlane(const CLM& clm_model, double fx, double fy,
// This is because rotation estimate under orthographic assumption is only correct close to the centre of the image
// This method returns a corrected pose estimate with respect to the camera plane (Experimental)
// The format returned is [Tx, Ty, Tz, Eul_x, Eul_y, Eul_z]
Vec6d CLMTracker::GetCorrectedPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params)
Vec6d CLMTracker::GetCorrectedPoseCameraPlane(const CLM& clm_model, double fx, double fy, double cx, double cy)
{
if(!clm_model.detected_landmarks.empty() && clm_model.params_global[0] != 0 && clm_model.tracking_initialised)
{
Expand Down Expand Up @@ -156,7 +156,7 @@ Vec6d CLMTracker::GetCorrectedPoseCameraPlane(const CLM& clm_model, double fx, d
// This is because rotation estimate under orthographic assumption is only correct close to the centre of the image
// This method returns a corrected pose estimate with respect to a point camera (NOTE not the camera plane) (Experimental)
// The format returned is [Tx, Ty, Tz, Eul_x, Eul_y, Eul_z]
Vec6d CLMTracker::GetCorrectedPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy, const CLMParameters& params)
Vec6d CLMTracker::GetCorrectedPoseCamera(const CLM& clm_model, double fx, double fy, double cx, double cy)
{
if(!clm_model.detected_landmarks.empty() && clm_model.params_global[0] != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/local/FaceAnalyser/include/GazeEstimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ using namespace cv;
namespace FaceAnalysis
{

void EstimateGaze(const CLMTracker::CLM& clm_model, const CLMTracker::CLMParameters& clm_parameters, Point3f& gaze_absolute, Point3f& gaze_head, float fx, float fy, float cx, float cy, bool left_eye);
void EstimateGaze(const CLMTracker::CLM& clm_model, Point3f& gaze_absolute, Point3f& gaze_head, float fx, float fy, float cx, float cy, bool left_eye);
void DrawGaze(Mat img, const CLMTracker::CLM& clm_model, Point3f gazeVecAxisLeft, Point3f gazeVecAxisRight, float fx, float fy, float cx, float cy);

}
Expand Down
4 changes: 2 additions & 2 deletions lib/local/FaceAnalyser/src/GazeEstimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ Point3f GetPupilPosition(Mat_<double> eyeLdmks3d){
return p;
}

void FaceAnalysis::EstimateGaze(const CLMTracker::CLM& clm_model, const CLMTracker::CLMParameters& clm_parameters, Point3f& gaze_absolute, Point3f& gaze_head, float fx, float fy, float cx, float cy, bool left_eye)
void FaceAnalysis::EstimateGaze(const CLMTracker::CLM& clm_model, Point3f& gaze_absolute, Point3f& gaze_head, float fx, float fy, float cx, float cy, bool left_eye)
{
Vec6d headPose = CLMTracker::GetPoseCamera(clm_model, fx, fy, cx, cy, clm_parameters);
Vec6d headPose = CLMTracker::GetPoseCamera(clm_model, fx, fy, cx, cy);
Vec3d eulerAngles(headPose(3), headPose(4), headPose(5));
Matx33d rotMat = CLMTracker::Euler2RotationMatrix(eulerAngles);

Expand Down

0 comments on commit b8a5601

Please sign in to comment.