Skip to content
2 changes: 1 addition & 1 deletion include/eos/core/LandmarkMapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class LandmarkMapper
*
* @return The number of landmark mappings.
*/
auto num_mappings() const { return landmark_mappings.size(); };
std::size_t num_mappings() const { return landmark_mappings.size(); };

private:
std::unordered_map<std::string, std::string>
Expand Down
5 changes: 4 additions & 1 deletion include/eos/core/read_obj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ inline void parse_vertex_normal(const std::string& line)
// f 3/1 4/2 5/3
// f 6/4/1 3/5/3 7/6/5
// f 7//1 8//2 9//3
inline auto parse_face(const std::string& line)
inline std::tuple<std::vector<int>,
std::vector<int>,
std::vector<int>>
parse_face(const std::string& line)
{
using std::string;
using std::vector;
Expand Down
2 changes: 1 addition & 1 deletion include/eos/fitting/RenderingParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class RenderingParameters
frustum = Frustum(l, r, b, t);
};

auto get_camera_type() const { return camera_type; };
CameraType get_camera_type() const { return camera_type; };

glm::quat get_rotation() const { return rotation; };

Expand Down
6 changes: 3 additions & 3 deletions include/eos/fitting/affine_camera_estimation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ inline cv::Vec2f project_affine(cv::Vec4f vertex, cv::Mat affine_camera_matrix,
{
// Transform to clip space:
cv::Mat clip_coords = affine_camera_matrix * cv::Mat(vertex);
cv::Vec2f clip_coords_vec = clip_coords.rowRange(0, 2);
// Take the x and y coordinates in clip space and apply the window transform:
cv::Vec2f screen_coords =
render::clip_to_screen_space(cv::Vec2f(clip_coords.rowRange(0, 2)), screen_width, screen_height);
return screen_coords;
auto screen_coords = eos::render::clip_to_screen_space({ clip_coords_vec[0], clip_coords_vec[1] }, screen_width, screen_height);
return cv::Vec2f(screen_coords.x, screen_coords.y);
};

} /* namespace fitting */
Expand Down
2 changes: 1 addition & 1 deletion include/eos/fitting/closest_edge_fitting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ inline std::vector<int> occluding_boundary_vertices(const core::Mesh& mesh,
{
// Rotate the mesh:
std::vector<glm::vec4> rotated_vertices;
std::for_each(begin(mesh.vertices), end(mesh.vertices), [&rotated_vertices, &R](const auto& v) {
std::for_each(begin(mesh.vertices), end(mesh.vertices), [&rotated_vertices, &R](const Eigen::Vector3f& v) {
rotated_vertices.push_back(R * glm::vec4(v[0], v[1], v[2], 1.0f));
});

Expand Down
2 changes: 1 addition & 1 deletion include/eos/fitting/contour_correspondence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ get_nearest_contour_correspondences(const core::LandmarkCollection<Eigen::Vector
// Check if the contour landmark is amongst the landmarks given to us (from detector or ground truth):
// (Note: Alternatively, we could filter landmarks beforehand and then just loop over landmarks =>
// means one less function param here. Separate filtering from actual algorithm.)
const auto result = std::find_if(begin(landmarks), end(landmarks), [&ibug_idx](auto&& e) {
const auto result = std::find_if(begin(landmarks), end(landmarks), [&ibug_idx](const core::Landmark<Eigen::Vector2f>& e) {
return e.name == ibug_idx;
}); // => this can go outside the loop
if (result == std::end(landmarks))
Expand Down
11 changes: 7 additions & 4 deletions include/eos/fitting/fitting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ inline Eigen::VectorXf fit_shape(Eigen::Matrix<float, 3, 4> affine_camera_matrix
* @return A tuple of [image_points, model_points, vertex_indices].
*/
template <class T>
inline auto get_corresponding_pointset(const T& landmarks, const core::LandmarkMapper& landmark_mapper,
inline std::tuple<std::vector<Eigen::Vector2f>,
std::vector<Eigen::Vector4f>,
std::vector<int>>
get_corresponding_pointset(const T& landmarks, const core::LandmarkMapper& landmark_mapper,
const morphablemodel::MorphableModel& morphable_model)
{
using Eigen::Vector2f;
Expand Down Expand Up @@ -213,7 +216,7 @@ inline auto get_corresponding_pointset(const T& landmarks, const core::LandmarkM
* @return The concatenated vector.
*/
template <class T>
inline auto concat(const std::vector<T>& vec_a, const std::vector<T>& vec_b)
inline std::vector<T> concat(const std::vector<T>& vec_a, const std::vector<T>& vec_b)
{
std::vector<T> concatenated_vec;
concatenated_vec.reserve(vec_a.size() + vec_b.size());
Expand Down Expand Up @@ -389,14 +392,14 @@ inline std::pair<core::Mesh, fitting::RenderingParameters> fit_shape_and_pose(
auto contour_landmarks_ =
core::filter(landmarks, contour_landmarks.left_contour); // Can do this outside of the loop
std::for_each(begin(contour_landmarks_), end(contour_landmarks_),
[&occluding_contour_landmarks](auto&& lm) {
[&occluding_contour_landmarks](const core::Landmark<Eigen::Vector2f>& lm) {
occluding_contour_landmarks.push_back({lm.coordinates[0], lm.coordinates[1]});
});
} else
{
auto contour_landmarks_ = core::filter(landmarks, contour_landmarks.right_contour);
std::for_each(begin(contour_landmarks_), end(contour_landmarks_),
[&occluding_contour_landmarks](auto&& lm) {
[&occluding_contour_landmarks](const core::Landmark<Eigen::Vector2f>& lm) {
occluding_contour_landmarks.push_back({lm.coordinates[0], lm.coordinates[1]});
});
}
Expand Down
4 changes: 2 additions & 2 deletions include/eos/fitting/multi_image_fitting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,15 @@ inline std::pair<std::vector<core::Mesh>, std::vector<fitting::RenderingParamete
landmarks[j], contour_landmarks.left_contour); // Can do this outside of the loop
std::for_each(
begin(contour_landmarks_), end(contour_landmarks_),
[&occluding_contour_landmarks](auto&& lm) {
[&occluding_contour_landmarks](const core::Landmark<Vector2f>& lm) {
occluding_contour_landmarks.push_back({lm.coordinates[0], lm.coordinates[1]});
});
} else
{
auto contour_landmarks_ = core::filter(landmarks[j], contour_landmarks.right_contour);
std::for_each(
begin(contour_landmarks_), end(contour_landmarks_),
[&occluding_contour_landmarks](auto&& lm) {
[&occluding_contour_landmarks](const core::Landmark<Vector2f>& lm) {
occluding_contour_landmarks.push_back({lm.coordinates[0], lm.coordinates[1]});
});
}
Expand Down
6 changes: 3 additions & 3 deletions include/eos/morphablemodel/MorphableModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ inline core::Mesh sample_to_mesh(const Eigen::VectorXf& shape_instance, const Ei
for (auto i = 0; i < num_vertices; ++i)
{
mesh.colors[i] = Eigen::Vector3f(
std::clamp(color_instance(i * 3 + 0), 0.0f, 1.0f),
std::clamp(color_instance(i * 3 + 1), 0.0f, 1.0f),
std::clamp(color_instance(i * 3 + 2), 0.0f, 1.0f)); // We use RGB order everywhere.
glm::clamp(color_instance(i * 3 + 0), 0.0f, 1.0f),
glm::clamp(color_instance(i * 3 + 1), 0.0f, 1.0f),
glm::clamp(color_instance(i * 3 + 2), 0.0f, 1.0f)); // We use RGB order everywhere.
}
}

Expand Down
4 changes: 2 additions & 2 deletions include/eos/render/FragmentShader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ class ExtractionFragmentShader
corrected_lambda[2] * point_c.texcoords;

// Texturing, no mipmapping:
cv::Vec2f image_tex_coords = detail::texcoord_wrap(cv::Vec2f(texcoords_persp.s, texcoords_persp.t));
auto image_tex_coords = detail::texcoord_wrap({texcoords_persp.s, texcoords_persp.t});
image_tex_coords[0] *= texture->mipmaps[0].cols;
image_tex_coords[1] *= texture->mipmaps[0].rows;
cv::Vec3f texture_color = detail::tex2d_linear(image_tex_coords, 0, texture.get()) / 255.0;
auto texture_color = detail::tex2d_linear(image_tex_coords, 0, texture.get()) / 255.0;
glm::tvec3<T, P> pixel_color = glm::tvec3<T, P>(texture_color[2], texture_color[1], texture_color[0]);
return glm::tvec4<T, P>(pixel_color, T(1));
};
Expand Down
2 changes: 1 addition & 1 deletion include/eos/render/SoftwareRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class SoftwareRenderer
* @param[in] plane_normal X.
* @ return X.
*/
template <typename T, glm::precision P = glm::defaultp>
template <typename T, glm::precision P>
std::vector<detail::Vertex<T, P>>
clip_polygon_to_plane_in_4d(const std::vector<detail::Vertex<T, P>>& vertices,
const glm::tvec4<T, P>& plane_normal)
Expand Down
2 changes: 1 addition & 1 deletion include/eos/render/render.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ render(core::Mesh mesh, glm::tmat4x4<float> model_view_matrix, glm::tmat4x4<floa
viewport_width); // Make sure it's initialised with zeros - the current Image4u c'tor does it.
core::Image1d depthbuffer(viewport_height, viewport_width);
std::for_each(std::begin(depthbuffer.data), std::end(depthbuffer.data),
[](auto& element) { element = std::numeric_limits<double>::max(); });
[](double& element) { element = std::numeric_limits<double>::max(); });

// Vertex shader:
// processedVertex = shade(Vertex); // processedVertex : pos, col, tex, texweight
Expand Down
2 changes: 1 addition & 1 deletion include/eos/render/render_affine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ inline std::pair<core::Image4u, core::Image1d> render_affine(const core::Mesh& m
viewport_width); // Note: auto-initialised to zeros. If we change the Image class, take care of that!
Image1d depthbuffer(viewport_height, viewport_width);
std::for_each(std::begin(depthbuffer.data), std::end(depthbuffer.data),
[](auto& element) { element = std::numeric_limits<double>::max(); });
[](double& element) { element = std::numeric_limits<double>::max(); });

const Eigen::Matrix<float, 4, 4> affine_with_z =
detail::calculate_affine_z_direction(affine_camera_matrix);
Expand Down
2 changes: 1 addition & 1 deletion include/eos/render/texture_extraction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace render {
* cij - matrix coefficients
*/
// Note: The original functions used doubles.
Eigen::Matrix<float, 2, 3> get_affine_transform(const std::array<Eigen::Vector2f, 3>& src,
inline Eigen::Matrix<float, 2, 3> get_affine_transform(const std::array<Eigen::Vector2f, 3>& src,
const std::array<Eigen::Vector2f, 3>& dst)
{
using Eigen::Matrix;
Expand Down
5 changes: 3 additions & 2 deletions include/eos/video/Keyframe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ struct PoseBinningKeyframeSelector
return false;
}
// Add the keyframe:
bins[idx].push_back(video::Keyframe{frame_score, image, fitting_result});
bins[idx].push_back(video::Keyframe<ImageType>{frame_score, image, fitting_result});
if (bins[idx].size() > frames_per_bin)
{
// need to remove the lowest one:
std::sort(std::begin(bins[idx]), std::end(bins[idx]),
[](const auto& lhs, const auto& rhs) { return lhs.score > rhs.score; });
[](const std::vector<Keyframe<ImageType>>& lhs,
const std::vector<Keyframe<ImageType>>& rhs) { return lhs.score > rhs.score; });
bins[idx].resize(frames_per_bin);
}
return true;
Expand Down
1 change: 1 addition & 0 deletions include/eos/video/keyframe_merging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "eos/core/Image_opencv_interop.hpp"
#include "eos/morphablemodel/Blendshape.hpp"
#include "eos/morphablemodel/MorphableModel.hpp"
#include "eos/render/texture_extraction.hpp"
#include "eos/video/Keyframe.hpp"

#include "Eigen/Core"
Expand Down