Some bug fixes with visualization.

This commit is contained in:
Tadas Baltrusaitis 2017-11-12 11:24:25 +00:00
parent 5ce0a8d4bf
commit 73d8dddbb2
3 changed files with 15 additions and 8 deletions

View file

@ -200,9 +200,6 @@ int main (int argc, char **argv)
// Work out the pose of the head from the tracked model // Work out the pose of the head from the tracked model
cv::Vec6d pose_estimate = LandmarkDetector::GetPose(face_model, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy); cv::Vec6d pose_estimate = LandmarkDetector::GetPose(face_model, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy);
// Drawing the visualization on the captured image
visualise_tracking(captured_image, face_model, det_parameters, gazeDirection0, gazeDirection1, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy);
// Displaying the tracking visualizations // Displaying the tracking visualizations
visualizer.SetImage(captured_image, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy); visualizer.SetImage(captured_image, sequence_reader.fx, sequence_reader.fy, sequence_reader.cx, sequence_reader.cy);
visualizer.SetObservationFaceAlign(sim_warped_img); visualizer.SetObservationFaceAlign(sim_warped_img);

View file

@ -813,11 +813,11 @@ vector<cv::Point3d> Calculate3DEyeLandmarks(const CLNF& clnf_model, double fx, d
auto lmks = clnf_model.hierarchical_models[i].GetShape(fx, fy, cx, cy); auto lmks = clnf_model.hierarchical_models[i].GetShape(fx, fy, cx, cy);
int num_landmarks = lmks.rows / 3; int num_landmarks = lmks.cols;
for (int lmk = 0; lmk < num_landmarks; ++lmk) for (int lmk = 0; lmk < num_landmarks; ++lmk)
{ {
cv::Point3d curr_lmk(lmks.at<double>(lmk), lmks.at<double>(lmk + num_landmarks), lmks.at<double>(lmk + 2 * num_landmarks)); cv::Point3d curr_lmk(lmks.at<double>(0, lmk), lmks.at<double>(1, lmk), lmks.at<double>(2, lmk));
to_return.push_back(curr_lmk); to_return.push_back(curr_lmk);
} }
} }

View file

@ -99,7 +99,10 @@ void Visualizer::SetObservationFaceAlign(const cv::Mat& aligned_face)
void Visualizer::SetObservationHOG(const cv::Mat_<double>& hog_descriptor, int num_cols, int num_rows) void Visualizer::SetObservationHOG(const cv::Mat_<double>& hog_descriptor, int num_cols, int num_rows)
{ {
if(vis_hog)
{
Visualise_FHOG(hog_descriptor, num_rows, num_cols, this->hog_image); Visualise_FHOG(hog_descriptor, num_rows, num_cols, this->hog_image);
}
} }
@ -173,6 +176,13 @@ void Visualizer::SetObservationGaze(const cv::Point3f& gaze_direction0, const cv
if (i == 27) if (i == 27)
next_point = 20; next_point = 20;
if (i == 7 + 28)
next_point = 0 + 28;
if (i == 19 + 28)
next_point = 8 + 28;
if (i == 27 + 28)
next_point = 20 + 28;
cv::Point nextFeaturePoint(cvRound(eye_landmarks2d[next_point].x * (double)draw_multiplier), cvRound(eye_landmarks2d[next_point].y * (double)draw_multiplier)); cv::Point nextFeaturePoint(cvRound(eye_landmarks2d[next_point].x * (double)draw_multiplier), cvRound(eye_landmarks2d[next_point].y * (double)draw_multiplier));
if (i < 8 || i > 19) if (i < 8 || i > 19)
cv::line(captured_image, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits); cv::line(captured_image, featurePoint, nextFeaturePoint, cv::Scalar(255, 0, 0), thickness_2, CV_AA, draw_shiftbits);
@ -190,7 +200,7 @@ void Visualizer::SetObservationGaze(const cv::Point3f& gaze_direction0, const cv
for (size_t i = 0; i < 8; ++i) for (size_t i = 0; i < 8; ++i)
{ {
pupil_left = pupil_left + eye_landmarks3d[i]; pupil_left = pupil_left + eye_landmarks3d[i];
pupil_right = pupil_right + eye_landmarks3d[i + eye_landmarks3d.size()]; pupil_right = pupil_right + eye_landmarks3d[i + eye_landmarks3d.size()/2];
} }
pupil_left = pupil_left / 8; pupil_left = pupil_left / 8;
pupil_right = pupil_right / 8; pupil_right = pupil_right / 8;
@ -224,7 +234,6 @@ void Visualizer::ShowObservation()
{ {
cv::namedWindow("tracking_result", 1); cv::namedWindow("tracking_result", 1);
cv::imshow("tracking_result", captured_image); cv::imshow("tracking_result", captured_image);
cv::waitKey(1);
} }
if (vis_align) if (vis_align)
{ {
@ -234,6 +243,7 @@ void Visualizer::ShowObservation()
{ {
cv::imshow("hog", hog_image); cv::imshow("hog", hog_image);
} }
cv::waitKey(1);
} }
cv::Mat Visualizer::GetVisImage() cv::Mat Visualizer::GetVisImage()