More work on visualization interop.

This commit is contained in:
Tadas Baltrusaitis 2018-01-19 16:33:17 +00:00
parent 57c8bb75ea
commit 85262b72c7
5 changed files with 20 additions and 8 deletions

View file

@ -498,8 +498,7 @@ namespace OpenFaceOffline
visualizer.SetObservationHOG(face_analyser.GetLatestHOGFeature(), face_analyser.GetHOGRows(), face_analyser.GetHOGCols()); visualizer.SetObservationHOG(face_analyser.GetLatestHOGFeature(), face_analyser.GetHOGRows(), face_analyser.GetHOGCols());
visualizer.SetObservationLandmarks(landmarks, confidence); // Set confidence to high to make sure we always visualize visualizer.SetObservationLandmarks(landmarks, confidence); // Set confidence to high to make sure we always visualize
visualizer.SetObservationPose(pose, confidence); visualizer.SetObservationPose(pose, confidence);
//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); visualizer.SetObservationGaze(gaze_analyser.GetGazeCamera().Item1, gaze_analyser.GetGazeCamera().Item2, clnf_model.CalculateAllEyeLandmarks(), clnf_model.CalculateAllEyeLandmarks3D(fx, fy, cx, cy), confidence);
if (detectionSucceeding) if (detectionSucceeding)
{ {
@ -618,7 +617,7 @@ namespace OpenFaceOffline
if (ShowAppearance) if (ShowAppearance)
{ {
RawImage aligned_face = face_analyser.GetLatestAlignedFace(); RawImage aligned_face = face_analyser.GetLatestAlignedFace();
RawImage hog_face = face_analyser.GetLatestHOGDescriptorVisualisation(); RawImage hog_face = visualizer.GetHOGVis();
if (latest_aligned_face == null) if (latest_aligned_face == null)
{ {

View file

@ -330,11 +330,6 @@ public:
return face_aligned_image; return face_aligned_image;
} }
OpenCVWrappers::RawImage^ GetLatestHOGDescriptorVisualisation() {
OpenCVWrappers::RawImage^ HOG_vis_image = gcnew OpenCVWrappers::RawImage(*visualisation);
return HOG_vis_image;
}
OpenCVWrappers::RawImage^ GetLatestHOGFeature() { OpenCVWrappers::RawImage^ GetLatestHOGFeature() {
OpenCVWrappers::RawImage^ HOG_feature = gcnew OpenCVWrappers::RawImage(*hog_features); OpenCVWrappers::RawImage^ HOG_feature = gcnew OpenCVWrappers::RawImage(*hog_features);
return HOG_feature; return HOG_feature;

View file

@ -113,6 +113,18 @@ namespace UtilitiesOF {
m_visualizer->SetObservationLandmarks(landmarks_2D_mat, confidence); m_visualizer->SetObservationLandmarks(landmarks_2D_mat, confidence);
} }
OpenCVWrappers::RawImage^ GetHOGVis()
{
OpenCVWrappers::RawImage^ hog_image = gcnew OpenCVWrappers::RawImage(m_visualizer->GetHOGVis());
return hog_image;
}
OpenCVWrappers::RawImage^ GetVisImage()
{
OpenCVWrappers::RawImage^ vis_image = gcnew OpenCVWrappers::RawImage(m_visualizer->GetVisImage());
return vis_image;
}
// Finalizer. Definitely called before Garbage Collection, // Finalizer. Definitely called before Garbage Collection,
// but not automatically called on explicit Dispose(). // but not automatically called on explicit Dispose().
// May be called multiple times. // May be called multiple times.

View file

@ -82,6 +82,7 @@ namespace Utilities
char ShowObservation(); char ShowObservation();
cv::Mat GetVisImage(); cv::Mat GetVisImage();
cv::Mat GetHOGVis();
// Keeping track of what we're visualizing // Keeping track of what we're visualizing
bool vis_track; bool vis_track;

View file

@ -292,3 +292,8 @@ cv::Mat Visualizer::GetVisImage()
{ {
return captured_image; return captured_image;
} }
cv::Mat Visualizer::GetHOGVis()
{
return hog_image;
}