Commit 455e5bb8 authored by Patrik Huber's avatar Patrik Huber

Fixed comments formatting and includes

parent bbc82d0d
...@@ -57,8 +57,8 @@ set(HEADERS ...@@ -57,8 +57,8 @@ set(HEADERS
include/eos/morphablemodel/PcaModel.hpp include/eos/morphablemodel/PcaModel.hpp
include/eos/morphablemodel/MorphableModel.hpp include/eos/morphablemodel/MorphableModel.hpp
include/eos/morphablemodel/io/cvssp.hpp include/eos/morphablemodel/io/cvssp.hpp
include/eos/fitting/AffineCameraEstimation.hpp include/eos/fitting/affine_camera_estimation.hpp
include/eos/fitting/LinearShapeFitting.hpp include/eos/fitting/linear_shape_fitting.hpp
include/eos/render/Mesh.hpp include/eos/render/Mesh.hpp
include/eos/render/utils.hpp include/eos/render/utils.hpp
) )
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "eos/core/LandmarkMapper.hpp" #include "eos/core/LandmarkMapper.hpp"
#include "eos/fitting/AffineCameraEstimation.hpp" #include "eos/fitting/affine_camera_estimation.hpp"
#include "eos/fitting/LinearShapeFitting.hpp" #include "eos/fitting/linear_shape_fitting.hpp"
#include "eos/morphablemodel/io/cvssp.hpp" #include "eos/morphablemodel/io/cvssp.hpp"
#include "eos/render/utils.hpp" #include "eos/render/utils.hpp"
......
/* /*
* Eos - A 3D Morphable Model fitting library written in modern C++11/14. * Eos - A 3D Morphable Model fitting library written in modern C++11/14.
* *
* File: include/eos/fitting/AffineCameraEstimation.hpp * File: include/eos/fitting/affine_camera_estimation.hpp
* *
* Copyright 2014, 2015 Patrik Huber * Copyright 2014, 2015 Patrik Huber
* *
...@@ -84,8 +84,8 @@ cv::Mat estimate_affine_camera(std::vector<cv::Vec2f> image_points, std::vector< ...@@ -84,8 +84,8 @@ cv::Mat estimate_affine_camera(std::vector<cv::Vec2f> image_points, std::vector<
// 2) multiply every vectors coordinate by sqrt(2)/avgnorm // 2) multiply every vectors coordinate by sqrt(2)/avgnorm
float scaleFactor = std::sqrt(2) / averageNorm; float scaleFactor = std::sqrt(2) / averageNorm;
matImagePoints *= scaleFactor; // add unit homogeneous component here matImagePoints *= scaleFactor; // add unit homogeneous component here
// The points in matImagePoints now have a RMS distance from the origin of sqrt(2). // The points in matImagePoints now have a RMS distance from the origin of sqrt(2).
// The normalisation matrix so that the 2D points are mean-free and their norm is as described above. // The normalisation matrix so that the 2D points are mean-free and their norm is as described above.
Mat T = Mat::zeros(3, 3, CV_32FC1); Mat T = Mat::zeros(3, 3, CV_32FC1);
T.at<float>(0, 0) = scaleFactor; // s_x T.at<float>(0, 0) = scaleFactor; // s_x
T.at<float>(1, 1) = scaleFactor; // s_y T.at<float>(1, 1) = scaleFactor; // s_y
...@@ -95,7 +95,7 @@ cv::Mat estimate_affine_camera(std::vector<cv::Vec2f> image_points, std::vector< ...@@ -95,7 +95,7 @@ cv::Mat estimate_affine_camera(std::vector<cv::Vec2f> image_points, std::vector<
// center the model points to the origin: // center the model points to the origin:
Mat tmpOrigMdlPoints = matModelPoints.clone(); // Temp for testing: Save the original coordinates. Mat tmpOrigMdlPoints = matModelPoints.clone(); // Temp for testing: Save the original coordinates.
// translate the centroid of the model points to the origin: // translate the centroid of the model points to the origin:
Mat modelPointsMean; // use non-homogeneous coords for the next few steps? (less submatrices etc overhead) Mat modelPointsMean; // use non-homogeneous coords for the next few steps? (less submatrices etc overhead)
cv::reduce(matModelPoints, modelPointsMean, 0, CV_REDUCE_AVG); cv::reduce(matModelPoints, modelPointsMean, 0, CV_REDUCE_AVG);
modelPointsMean = cv::repeat(modelPointsMean, matModelPoints.rows, 1); modelPointsMean = cv::repeat(modelPointsMean, matModelPoints.rows, 1);
...@@ -110,8 +110,8 @@ cv::Mat estimate_affine_camera(std::vector<cv::Vec2f> image_points, std::vector< ...@@ -110,8 +110,8 @@ cv::Mat estimate_affine_camera(std::vector<cv::Vec2f> image_points, std::vector<
// 2) multiply every vectors coordinate by sqrt(3)/avgnorm // 2) multiply every vectors coordinate by sqrt(3)/avgnorm
scaleFactor = std::sqrt(3) / averageNorm; scaleFactor = std::sqrt(3) / averageNorm;
matModelPoints *= scaleFactor; // add unit homogeneous component here matModelPoints *= scaleFactor; // add unit homogeneous component here
// The points in matModelPoints now have a RMS distance from the origin of sqrt(3). // The points in matModelPoints now have a RMS distance from the origin of sqrt(3).
// The normalisation matrix so that the 3D points are mean-free and their norm is as described above. // The normalisation matrix so that the 3D points are mean-free and their norm is as described above.
Mat U = Mat::zeros(4, 4, CV_32FC1); Mat U = Mat::zeros(4, 4, CV_32FC1);
U.at<float>(0, 0) = scaleFactor; // s_x U.at<float>(0, 0) = scaleFactor; // s_x
U.at<float>(1, 1) = scaleFactor; // s_y U.at<float>(1, 1) = scaleFactor; // s_y
......
/* /*
* Eos - A 3D Morphable Model fitting library written in modern C++11/14. * Eos - A 3D Morphable Model fitting library written in modern C++11/14.
* *
* File: include/eos/fitting/LinearShapeFitting.hpp * File: include/eos/fitting/linear_shape_fitting.hpp
* *
* Copyright 2014, 2015 Patrik Huber * Copyright 2014, 2015 Patrik Huber
* *
...@@ -91,7 +91,7 @@ inline std::vector<float> fit_shape_to_landmarks_linear(morphablemodel::Morphabl ...@@ -91,7 +91,7 @@ inline std::vector<float> fit_shape_to_landmarks_linear(morphablemodel::Morphabl
Sigma.at<float>(i, i) = 1.0f / sigma_2D_3D; // the higher the sigma_2D_3D, the smaller the diagonal entries of Sigma will be Sigma.at<float>(i, i) = 1.0f / sigma_2D_3D; // the higher the sigma_2D_3D, the smaller the diagonal entries of Sigma will be
} }
Mat Omega = Sigma.t() * Sigma; // just squares the diagonal Mat Omega = Sigma.t() * Sigma; // just squares the diagonal
// The landmarks in matrix notation (in homogeneous coordinates), $3N\times 1$ // The landmarks in matrix notation (in homogeneous coordinates), $3N\times 1$
Mat y = Mat::ones(3 * landmarks.size(), 1, CV_32FC1); Mat y = Mat::ones(3 * landmarks.size(), 1, CV_32FC1);
for (int i = 0; i < landmarks.size(); ++i) { for (int i = 0; i < landmarks.size(); ++i) {
y.at<float>(3 * i, 0) = landmarks[i][0]; y.at<float>(3 * i, 0) = landmarks[i][0];
...@@ -112,8 +112,8 @@ inline std::vector<float> fit_shape_to_landmarks_linear(morphablemodel::Morphabl ...@@ -112,8 +112,8 @@ inline std::vector<float> fit_shape_to_landmarks_linear(morphablemodel::Morphabl
// Bring into standard regularised quadratic form with diagonal distance matrix Omega // Bring into standard regularised quadratic form with diagonal distance matrix Omega
Mat A = P * V_hat_h; // camera matrix times the basis Mat A = P * V_hat_h; // camera matrix times the basis
Mat b = P * v_bar - y; // camera matrix times the mean, minus the landmarks. Mat b = P * v_bar - y; // camera matrix times the mean, minus the landmarks.
//Mat c_s; // The x, we solve for this! (the variance-normalised shape parameter vector, $c_s = [a_1/sigma_{s,1} , ..., a_m-1/sigma_{s,m-1}]^t$ //Mat c_s; // The x, we solve for this! (the variance-normalised shape parameter vector, $c_s = [a_1/sigma_{s,1} , ..., a_m-1/sigma_{s,m-1}]^t$
//int numShapePc = morphableModel.getShapeModel().getNumberOfPrincipalComponents(); //int numShapePc = morphableModel.getShapeModel().getNumberOfPrincipalComponents();
int num_shape_pc = num_coeffs_to_fit; int num_shape_pc = num_coeffs_to_fit;
Mat AtOmegaA = A.t() * Omega * A; Mat AtOmegaA = A.t() * Omega * A;
Mat AtOmegaAReg = AtOmegaA + lambda * Mat::eye(num_shape_pc, num_shape_pc, CV_32FC1); Mat AtOmegaAReg = AtOmegaA + lambda * Mat::eye(num_shape_pc, num_shape_pc, CV_32FC1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment