Towards getting hog recording in GUI image processing.
This commit is contained in:
parent
df23dc2eb5
commit
3b21213f41
3 changed files with 24 additions and 7 deletions
|
@ -458,10 +458,12 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
recorder.SetObservationFaceAlign(face_analyser.GetLatestAlignedFace());
|
recorder.SetObservationFaceAlign(face_analyser.GetLatestAlignedFace());
|
||||||
|
|
||||||
|
var hog_feature = face_analyser.GetLatestHOGFeature();
|
||||||
|
//open_face_rec.SetObservationHOG(face_model.detection_success, hog_descriptor, num_hog_rows, num_hog_cols, 31); // The number of channels in HOG is fixed at the moment, as using FHOG
|
||||||
|
|
||||||
recorder.WriteObservation();
|
recorder.WriteObservation();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
//open_face_rec.SetObservationHOG(face_model.detection_success, hog_descriptor, num_hog_rows, num_hog_cols, 31); // The number of channels in HOG is fixed at the moment, as using FHOG
|
|
||||||
//open_face_rec.SetObservationVisualization(visualizer.GetVisImage());
|
//open_face_rec.SetObservationVisualization(visualizer.GetVisImage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ private:
|
||||||
FaceAnalysis::FaceAnalyser* face_analyser;
|
FaceAnalysis::FaceAnalyser* face_analyser;
|
||||||
|
|
||||||
// The actual descriptors (for visualisation and output)
|
// The actual descriptors (for visualisation and output)
|
||||||
cv::Mat_<double>* hog_features;
|
cv::Mat_<float>* hog_features;
|
||||||
cv::Mat* aligned_face;
|
cv::Mat* aligned_face;
|
||||||
cv::Mat* visualisation;
|
cv::Mat* visualisation;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
params.setAlignedOutput(output_width);
|
params.setAlignedOutput(output_width);
|
||||||
face_analyser = new FaceAnalysis::FaceAnalyser(params);
|
face_analyser = new FaceAnalysis::FaceAnalyser(params);
|
||||||
|
|
||||||
hog_features = new cv::Mat_<double>();
|
hog_features = new cv::Mat_<float>();
|
||||||
|
|
||||||
aligned_face = new cv::Mat();
|
aligned_face = new cv::Mat();
|
||||||
visualisation = new cv::Mat();
|
visualisation = new cv::Mat();
|
||||||
|
@ -172,7 +172,7 @@ public:
|
||||||
|
|
||||||
hog_output_file->write((char*)(&good_frame_float), 4);
|
hog_output_file->write((char*)(&good_frame_float), 4);
|
||||||
|
|
||||||
cv::MatConstIterator_<double> descriptor_it = hog_features->begin();
|
cv::MatConstIterator_<float> descriptor_it = hog_features->begin();
|
||||||
|
|
||||||
for(int y = 0; y < *num_cols; ++y)
|
for(int y = 0; y < *num_cols; ++y)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ public:
|
||||||
for(unsigned int o = 0; o < 31; ++o)
|
for(unsigned int o = 0; o < 31; ++o)
|
||||||
{
|
{
|
||||||
|
|
||||||
float hog_data = (float)(*descriptor_it++);
|
float hog_data = (*descriptor_it++);
|
||||||
hog_output_file->write((char*)&hog_data, 4);
|
hog_output_file->write((char*)&hog_data, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,9 @@ public:
|
||||||
|
|
||||||
face_analyser->AddNextFrame(frame->Mat, landmarks_mat, success, 0, online);
|
face_analyser->AddNextFrame(frame->Mat, landmarks_mat, success, 0, online);
|
||||||
|
|
||||||
face_analyser->GetLatestHOG(*hog_features, *num_rows, *num_cols);
|
cv::Mat_<double> hog_d;
|
||||||
|
face_analyser->GetLatestHOG(hog_d, *num_rows, *num_cols);
|
||||||
|
hog_d.convertTo(*hog_features, CV_64F);
|
||||||
|
|
||||||
face_analyser->GetLatestAlignedFace(*aligned_face);
|
face_analyser->GetLatestAlignedFace(*aligned_face);
|
||||||
|
|
||||||
|
@ -237,7 +239,10 @@ public:
|
||||||
face_analyser->PredictStaticAUsAndComputeFeatures(frame->Mat, landmarks_mat);
|
face_analyser->PredictStaticAUsAndComputeFeatures(frame->Mat, landmarks_mat);
|
||||||
|
|
||||||
// Set the computed appearance features
|
// Set the computed appearance features
|
||||||
face_analyser->GetLatestHOG(*hog_features, *num_rows, *num_cols);
|
cv::Mat_<double> hog_tmp;
|
||||||
|
face_analyser->GetLatestHOG(hog_tmp, *num_rows, *num_cols);
|
||||||
|
hog_tmp.convertTo(*hog_features, CV_32F);
|
||||||
|
|
||||||
face_analyser->GetLatestAlignedFace(*aligned_face);
|
face_analyser->GetLatestAlignedFace(*aligned_face);
|
||||||
|
|
||||||
if (vis_hog)
|
if (vis_hog)
|
||||||
|
@ -329,6 +334,11 @@ public:
|
||||||
OpenCVWrappers::RawImage^ HOG_vis_image = gcnew OpenCVWrappers::RawImage(*visualisation);
|
OpenCVWrappers::RawImage^ HOG_vis_image = gcnew OpenCVWrappers::RawImage(*visualisation);
|
||||||
return HOG_vis_image;
|
return HOG_vis_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenCVWrappers::RawImage^ GetLatestHOGFeature() {
|
||||||
|
OpenCVWrappers::RawImage^ HOG_feature = gcnew OpenCVWrappers::RawImage(*hog_features);
|
||||||
|
return HOG_feature;
|
||||||
|
}
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,6 +176,11 @@ namespace UtilitiesOF {
|
||||||
m_recorder->SetObservationFaceAlign(aligned_face_image->Mat);
|
m_recorder->SetObservationFaceAlign(aligned_face_image->Mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetObservationHOG(bool success, OpenCVWrappers::RawImage^ aligned_face_image, int num_cols, int num_rows, int num_channels)
|
||||||
|
{
|
||||||
|
m_recorder->SetObservationHOG(success, aligned_face_image->Mat, num_cols, num_rows, num_channels);
|
||||||
|
}
|
||||||
|
|
||||||
void SetObservationLandmarks(List<System::Tuple<double, double>^>^ landmarks_2D, List<System::Tuple<double, double, double>^>^ landmarks_3D, List<double>^ params_global, List<double>^ params_local, double confidence, bool success)
|
void SetObservationLandmarks(List<System::Tuple<double, double>^>^ landmarks_2D, List<System::Tuple<double, double, double>^>^ landmarks_3D, List<double>^ params_global, List<double>^ params_local, double confidence, bool success)
|
||||||
{
|
{
|
||||||
// Construct an OpenCV matrix from the landmarks
|
// Construct an OpenCV matrix from the landmarks
|
||||||
|
|
Loading…
Reference in a new issue