Moving visualization out of landmark detection.
This commit is contained in:
parent
312d9e9608
commit
420271ef23
2 changed files with 0 additions and 47 deletions
|
@ -81,13 +81,6 @@ namespace LandmarkDetector
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Visualisation functions
|
// Visualisation functions
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void Project(cv::Mat_<double>& dest, const cv::Mat_<double>& mesh, double fx, double fy, double cx, double cy);
|
|
||||||
void DrawBox(cv::Mat image, cv::Vec6d pose, cv::Scalar color, int thickness, float fx, float fy, float cx, float cy);
|
|
||||||
|
|
||||||
// Drawing face bounding box
|
|
||||||
vector<std::pair<cv::Point2d, cv::Point2d>> CalculateBox(cv::Vec6d pose, float fx, float fy, float cx, float cy);
|
|
||||||
void DrawBox(vector<pair<cv::Point, cv::Point>> lines, cv::Mat image, cv::Scalar color, int thickness);
|
|
||||||
|
|
||||||
vector<cv::Point2d> CalculateVisibleLandmarks(const cv::Mat_<double>& shape2D, const cv::Mat_<int>& visibilities);
|
vector<cv::Point2d> CalculateVisibleLandmarks(const cv::Mat_<double>& shape2D, const cv::Mat_<int>& visibilities);
|
||||||
vector<cv::Point2d> CalculateVisibleLandmarks(const CLNF& clnf_model);
|
vector<cv::Point2d> CalculateVisibleLandmarks(const CLNF& clnf_model);
|
||||||
vector<cv::Point2d> CalculateVisibleEyeLandmarks(const CLNF& clnf_model);
|
vector<cv::Point2d> CalculateVisibleEyeLandmarks(const CLNF& clnf_model);
|
||||||
|
|
|
@ -704,46 +704,6 @@ cv::Matx22d AlignShapesWithScale(cv::Mat_<double>& src, cv::Mat_<double> dst)
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Visualisation functions
|
// Visualisation functions
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void Project(cv::Mat_<double>& dest, const cv::Mat_<double>& mesh, double fx, double fy, double cx, double cy)
|
|
||||||
{
|
|
||||||
dest = cv::Mat_<double>(mesh.rows,2, 0.0);
|
|
||||||
|
|
||||||
int num_points = mesh.rows;
|
|
||||||
|
|
||||||
double X, Y, Z;
|
|
||||||
|
|
||||||
|
|
||||||
cv::Mat_<double>::const_iterator mData = mesh.begin();
|
|
||||||
cv::Mat_<double>::iterator projected = dest.begin();
|
|
||||||
|
|
||||||
for(int i = 0;i < num_points; i++)
|
|
||||||
{
|
|
||||||
// Get the points
|
|
||||||
X = *(mData++);
|
|
||||||
Y = *(mData++);
|
|
||||||
Z = *(mData++);
|
|
||||||
|
|
||||||
double x;
|
|
||||||
double y;
|
|
||||||
|
|
||||||
// if depth is 0 the projection is different
|
|
||||||
if(Z != 0)
|
|
||||||
{
|
|
||||||
x = ((X * fx / Z) + cx);
|
|
||||||
y = ((Y * fy / Z) + cy);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = X;
|
|
||||||
y = Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Project and store in dest matrix
|
|
||||||
(*projected++) = x;
|
|
||||||
(*projected++) = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawBox(cv::Mat image, cv::Vec6d pose, cv::Scalar color, int thickness, float fx, float fy, float cx, float cy)
|
void DrawBox(cv::Mat image, cv::Vec6d pose, cv::Scalar color, int thickness, float fx, float fy, float cx, float cy)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue