Bug fixes

This commit is contained in:
Tadas Baltrusaitis 2016-09-06 12:32:33 -04:00
parent 1b804c95b6
commit c1ff40399e
11 changed files with 16 additions and 18 deletions

View file

@ -194,11 +194,11 @@ void FaceAnalysis::DrawGaze(cv::Mat img, const LandmarkDetector::CLNF& clnf_mode
cv::Mat_<double> proj_points; cv::Mat_<double> proj_points;
cv::Mat_<double> mesh_0 = (cv::Mat_<double>(2, 3) << points_left[0].x, points_left[0].y, points_left[0].z, points_left[1].x, points_left[1].y, points_left[1].z); cv::Mat_<double> mesh_0 = (cv::Mat_<double>(2, 3) << points_left[0].x, points_left[0].y, points_left[0].z, points_left[1].x, points_left[1].y, points_left[1].z);
LandmarkDetector::Project(proj_points, mesh_0, fx, fy, cx, cy); LandmarkDetector::Project(proj_points, mesh_0, fx, fy, cx, cy);
cv::line(img, cv::Point(cvRound(proj_points.at<double>(0,0) * gaze_draw_multiplier), cvRound(proj_points.at<double>(0, 1) * gaze_draw_multiplier)), cv::line(img, cv::Point(cvRound(proj_points.at<double>(0,0) * (double)gaze_draw_multiplier), cvRound(proj_points.at<double>(0, 1) * (double)gaze_draw_multiplier)),
cv::Point(cvRound(proj_points.at<double>(1, 0) * gaze_draw_multiplier), cvRound(proj_points.at<double>(1, 1) * gaze_draw_multiplier)), cv::Scalar(110, 220, 0), 2, CV_AA, gaze_draw_shiftbits); cv::Point(cvRound(proj_points.at<double>(1, 0) * (double)gaze_draw_multiplier), cvRound(proj_points.at<double>(1, 1) * (double)gaze_draw_multiplier)), cv::Scalar(110, 220, 0), 2, CV_AA, gaze_draw_shiftbits);
cv::Mat_<double> mesh_1 = (cv::Mat_<double>(2, 3) << points_right[0].x, points_right[0].y, points_right[0].z, points_right[1].x, points_right[1].y, points_right[1].z); cv::Mat_<double> mesh_1 = (cv::Mat_<double>(2, 3) << points_right[0].x, points_right[0].y, points_right[0].z, points_right[1].x, points_right[1].y, points_right[1].z);
LandmarkDetector::Project(proj_points, mesh_1, fx, fy, cx, cy); LandmarkDetector::Project(proj_points, mesh_1, fx, fy, cx, cy);
cv::line(img, cv::Point(cvRound(proj_points.at<double>(0, 0) * gaze_draw_multiplier), cvRound(proj_points.at<double>(0, 1) * gaze_draw_multiplier)), cv::line(img, cv::Point(cvRound(proj_points.at<double>(0, 0) * (double)gaze_draw_multiplier), cvRound(proj_points.at<double>(0, 1) * (double)gaze_draw_multiplier)),
cv::Point(cvRound(proj_points.at<double>(1, 0) * gaze_draw_multiplier), cvRound(proj_points.at<double>(1, 1) * gaze_draw_multiplier)), cv::Scalar(110, 220, 0), 2, CV_AA, gaze_draw_shiftbits); cv::Point(cvRound(proj_points.at<double>(1, 0) * (double)gaze_draw_multiplier), cvRound(proj_points.at<double>(1, 1) * (double)gaze_draw_multiplier)), cv::Scalar(110, 220, 0), 2, CV_AA, gaze_draw_shiftbits);
} }

View file

@ -116,7 +116,7 @@ public:
int GetViewIdx(const cv::Vec6d& params_global, int scale) const; int GetViewIdx(const cv::Vec6d& params_global, int scale) const;
// The number of views at a particular scale // The number of views at a particular scale
inline int nViews(int scale = 0) const { return centers[scale].size(); }; inline int nViews(size_t scale = 0) const { return (int)centers[scale].size(); };
// Reading in all of the patch experts // Reading in all of the patch experts
void Read(vector<string> intensity_svr_expert_locations, vector<string> depth_svr_expert_locations, vector<string> intensity_ccnf_expert_locations); void Read(vector<string> intensity_svr_expert_locations, vector<string> depth_svr_expert_locations, vector<string> intensity_ccnf_expert_locations);

View file

@ -1,5 +1,5 @@
LandmarkDetector clnf_general.txt LandmarkDetector clnf_general.txt
LandmarkDetector_part model_inner/main_clnf_inner.txt inner 17 0 18 1 19 2 20 3 21 4 22 5 23 6 24 7 25 8 26 9 27 10 28 11 29 12 30 13 31 14 32 15 33 16 34 17 35 18 36 19 37 20 38 21 39 22 40 23 41 24 42 25 43 26 44 27 45 28 46 29 47 30 48 31 49 32 50 33 51 34 52 35 53 36 54 37 55 38 56 39 57 40 58 41 59 42 60 43 61 44 62 45 63 46 64 47 65 48 66 49 67 50 17 0 18 1 19 2 20 3 21 4 22 5 23 6 24 7 25 8 26 9 27 10 28 11 29 12 30 13 31 14 32 15 33 16 34 17 35 18 36 19 37 20 38 21 39 22 40 23 41 24 42 25 43 26 44 27 45 28 46 29 47 30 48 31 49 32 50 33 51 34 52 35 53 36 54 37 55 38 56 39 57 40 58 41 59 42 60 43 61 44 62 45 63 46 64 47 65 48 66 49 67 50 LandmarkDetector_part model_inner/main_clnf_inner.txt inner 17 0 18 1 19 2 20 3 21 4 22 5 23 6 24 7 25 8 26 9 27 10 28 11 29 12 30 13 31 14 32 15 33 16 34 17 35 18 36 19 37 20 38 21 39 22 40 23 41 24 42 25 43 26 44 27 45 28 46 29 47 30 48 31 49 32 50 33 51 34 52 35 53 36 54 37 55 38 56 39 57 40 58 41 59 42 60 43 61 44 62 45 63 46 64 47 65 48 66 49 67 50
LandmarkDetector_part model_eye/main_clnf_synth_left.txt left_eye_28 36 8 37 10 38 12 39 14 40 16 41 18 LandmarkDetector_part model_eye/main_clnf_synth_left.txt left_eye_28 36 8 37 10 38 12 39 14 40 16 41 18
LandmarkDetector_part model_eye/main_clnf_synth_right.txt right_eye_28 42 8 43 10 44 12 45 14 46 16 47 18 LandmarkDetector_part model_eye/main_clnf_synth_right.txt right_eye_28 42 8 43 10 44 12 45 14 46 16 47 18
FaceDetConversion haarAlign.txt FaceDetConversion haarAlign.txt

View file

@ -191,7 +191,7 @@ FaceModelParameters::FaceModelParameters(vector<string> &arguments)
} }
} }
for (int i = arguments.size() - 1; i >= 0; --i) for (int i = (int)arguments.size() - 1; i >= 0; --i)
{ {
if (!valid[i]) if (!valid[i])
{ {

View file

@ -904,8 +904,8 @@ void DrawBox(cv::Mat image, cv::Vec6d pose, cv::Scalar color, int thickness, flo
rotBoxProj.row(edges[i].second).copyTo(end); rotBoxProj.row(edges[i].second).copyTo(end);
cv::Point p1(cvRound(begin.at<double>(0) * draw_multiplier), cvRound(begin.at<double>(1) * draw_multiplier)); cv::Point p1(cvRound(begin.at<double>(0) * (double)draw_multiplier), cvRound(begin.at<double>(1) * (double)draw_multiplier));
cv::Point p2(cvRound(end.at<double>(0) * draw_multiplier), cvRound(end.at<double>(1) * draw_multiplier)); cv::Point p2(cvRound(end.at<double>(0) * (double)draw_multiplier), cvRound(end.at<double>(1) * (double)draw_multiplier));
// Only draw the line if one of the points is inside the image // Only draw the line if one of the points is inside the image
if(p1.inside(image_rect) || p2.inside(image_rect)) if(p1.inside(image_rect) || p2.inside(image_rect))
@ -1076,7 +1076,7 @@ void Draw(cv::Mat img, const cv::Mat_<double>& shape2D, const cv::Mat_<int>& vis
{ {
if(visibilities.at<int>(i)) if(visibilities.at<int>(i))
{ {
cv::Point featurePoint(cvRound(shape2D.at<double>(i) * draw_multiplier), cvRound(shape2D.at<double>(i + n) * draw_multiplier)); cv::Point featurePoint(cvRound(shape2D.at<double>(i) * (double)draw_multiplier), cvRound(shape2D.at<double>(i + n) * (double)draw_multiplier));
// A rough heuristic for drawn point size // A rough heuristic for drawn point size
int thickness = (int)std::ceil(3.0* ((double)img.cols) / 640.0); int thickness = (int)std::ceil(3.0* ((double)img.cols) / 640.0);
@ -1092,7 +1092,7 @@ void Draw(cv::Mat img, const cv::Mat_<double>& shape2D, const cv::Mat_<int>& vis
{ {
for( int i = 0; i < n; ++i) for( int i = 0; i < n; ++i)
{ {
cv::Point featurePoint(cvRound(shape2D.at<double>(i) * draw_multiplier), cvRound(shape2D.at<double>(i + n) * draw_multiplier)); cv::Point featurePoint(cvRound(shape2D.at<double>(i) * (double)draw_multiplier), cvRound(shape2D.at<double>(i + n) * (double)draw_multiplier));
// A rough heuristic for drawn point size // A rough heuristic for drawn point size
int thickness = 1.0; int thickness = 1.0;
@ -1106,7 +1106,7 @@ void Draw(cv::Mat img, const cv::Mat_<double>& shape2D, const cv::Mat_<int>& vis
if(i == 27) if(i == 27)
next_point = 20; next_point = 20;
cv::Point nextFeaturePoint(cvRound(shape2D.at<double>(next_point) * draw_multiplier), cvRound(shape2D.at<double>(next_point + n) * draw_multiplier)); cv::Point nextFeaturePoint(cvRound(shape2D.at<double>(next_point) * (double)draw_multiplier), cvRound(shape2D.at<double>(next_point + n) * (double)draw_multiplier));
if( i < 8 || i > 19) if( i < 8 || i > 19)
cv::line(img, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits); cv::line(img, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits);
else else
@ -1119,7 +1119,7 @@ void Draw(cv::Mat img, const cv::Mat_<double>& shape2D, const cv::Mat_<int>& vis
{ {
for( int i = 0; i < n; ++i) for( int i = 0; i < n; ++i)
{ {
cv::Point featurePoint(cvRound(shape2D.at<double>(i) * draw_multiplier), cvRound(shape2D.at<double>(i + n) * draw_multiplier)); cv::Point featurePoint(cvRound(shape2D.at<double>(i) * (double)draw_multiplier), cvRound(shape2D.at<double>(i + n) * (double)draw_multiplier));
// A rough heuristic for drawn point size // A rough heuristic for drawn point size
int thickness = 1.0; int thickness = 1.0;
@ -1129,7 +1129,7 @@ void Draw(cv::Mat img, const cv::Mat_<double>& shape2D, const cv::Mat_<int>& vis
if(i == 5) if(i == 5)
next_point = 0; next_point = 0;
cv::Point nextFeaturePoint(cvRound(shape2D.at<double>(next_point) * draw_multiplier), cvRound(shape2D.at<double>(next_point + n) * draw_multiplier)); cv::Point nextFeaturePoint(cvRound(shape2D.at<double>(next_point) * (double)draw_multiplier), cvRound(shape2D.at<double>(next_point + n) * (double)draw_multiplier));
cv::line(img, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits); cv::line(img, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits);
} }
} }
@ -1155,11 +1155,11 @@ void Draw(cv::Mat img, const cv::Mat_<double>& shape2D)
cv::Point featurePoint; cv::Point featurePoint;
if(shape2D.cols == 1) if(shape2D.cols == 1)
{ {
featurePoint = cv::Point(cvRound(shape2D.at<double>(i) * draw_multiplier), cvRound(shape2D.at<double>(i + n) * draw_multiplier)); featurePoint = cv::Point(cvRound(shape2D.at<double>(i) * (double)draw_multiplier), cvRound(shape2D.at<double>(i + n) * (double)draw_multiplier));
} }
else else
{ {
featurePoint = cv::Point(cvRound(shape2D.at<double>(i, 0) * draw_multiplier), cvRound(shape2D.at<double>(i, 1) * draw_multiplier)); featurePoint = cv::Point(cvRound(shape2D.at<double>(i, 0) * (double)draw_multiplier), cvRound(shape2D.at<double>(i, 1) * (double)draw_multiplier));
} }
// A rough heuristic for drawn point size // A rough heuristic for drawn point size
int thickness = (int)std::ceil(5.0* ((double)img.cols) / 640.0); int thickness = (int)std::ceil(5.0* ((double)img.cols) / 640.0);

View file

@ -1,8 +1,6 @@
% This is sort of the unit test for the whole module (needs datasets) % This is sort of the unit test for the whole module (needs datasets)
% Will take over an hour to run all % Will take over an hour to run all
% TODO need some unit testy things, some asserts
tic tic
%% Head pose %% Head pose
cd('Head Pose Experiments'); cd('Head Pose Experiments');