Bug fixes with image readers.

This commit is contained in:
Tadas Baltrusaitis 2017-11-19 20:04:00 +00:00
parent 974cee63b9
commit 488cd4d92f
3 changed files with 11 additions and 10 deletions

View file

@ -160,8 +160,6 @@ int main (int argc, char **argv)
// Load the models if images found
LandmarkDetector::FaceModelParameters det_parameters(arguments);
// No need to validate detections, as we're not doing tracking
det_parameters.validate_detections = false;
// The modules that are being used for tracking
cout << "Loading the model" << endl;
@ -256,8 +254,8 @@ int main (int argc, char **argv)
// Displaying the tracking visualizations
visualizer.SetObservationFaceAlign(sim_warped_img);
visualizer.SetObservationHOG(hog_descriptor, num_hog_rows, num_hog_cols);
visualizer.SetObservationLandmarks(face_model.detected_landmarks, face_model.detection_certainty, face_model.detection_success);
visualizer.SetObservationPose(pose_estimate, face_model.detection_certainty);
visualizer.SetObservationLandmarks(face_model.detected_landmarks, 1.0, face_model.detection_success); // Set confidence to high to make sure we always visualize
visualizer.SetObservationPose(pose_estimate, 1.0);
visualizer.SetObservationGaze(gaze_direction0, gaze_direction1, LandmarkDetector::CalculateAllEyeLandmarks(face_model), LandmarkDetector::Calculate3DEyeLandmarks(face_model, image_reader.fx, image_reader.fy, image_reader.cx, image_reader.cy), face_model.detection_certainty);
// Setting up the recorder output

View file

@ -369,18 +369,19 @@ void ImageCapture::SetCameraIntrinsics(float fx, float fy, float cx, float cy)
cv::Mat ImageCapture::GetNextImage()
{
frame_num++;
if (image_files.empty() || frame_num - 1 > image_files.size())
if (image_files.empty() || frame_num >= image_files.size())
{
// Indicate lack of success by returning an empty image
latest_frame = cv::Mat();
return latest_frame;
}
latest_frame = cv::imread(image_files[frame_num - 1], -1);
latest_frame = cv::imread(image_files[frame_num], -1);
if (latest_frame.empty())
{
ERROR_STREAM("Could not open the image: " + image_files[frame_num - 1]);
exit(1);
}
image_height = latest_frame.size().height;
@ -395,7 +396,9 @@ cv::Mat ImageCapture::GetNextImage()
// Set the grayscale frame
convertToGrayscale(latest_frame, latest_gray_frame);
this->name = boost::filesystem::path(image_files[frame_num - 1]).filename().replace_extension("").string();
this->name = boost::filesystem::path(image_files[frame_num]).filename().replace_extension("").string();
frame_num++;
return latest_frame;
}

View file

@ -44,7 +44,7 @@ else
multi_view = 0;
end
command = sprintf("%s -mloc %s -multiview %s -2Dfp -tracked ", executable, model, num2str(multi_view));
command = sprintf("%s -mloc %s -multi_view %s -2Dfp -tracked ", executable, model, num2str(multi_view));
% TODO just landmarks + BBoxes