diff --git a/include/eos/core/LandmarkMapper.hpp b/include/eos/core/LandmarkMapper.hpp index 178d14d38..e8fb93aba 100644 --- a/include/eos/core/LandmarkMapper.hpp +++ b/include/eos/core/LandmarkMapper.hpp @@ -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 diff --git a/include/eos/core/read_obj.hpp b/include/eos/core/read_obj.hpp index 54d3b5598..474ecb8ed 100644 --- a/include/eos/core/read_obj.hpp +++ b/include/eos/core/read_obj.hpp @@ -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, + std::vector> + parse_face(const std::string& line) { using std::string; using std::vector; diff --git a/include/eos/fitting/RenderingParameters.hpp b/include/eos/fitting/RenderingParameters.hpp index d24aba7c3..df942e2dd 100644 --- a/include/eos/fitting/RenderingParameters.hpp +++ b/include/eos/fitting/RenderingParameters.hpp @@ -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; }; diff --git a/include/eos/fitting/affine_camera_estimation.hpp b/include/eos/fitting/affine_camera_estimation.hpp index 42b2a97bb..d0cb01c45 100644 --- a/include/eos/fitting/affine_camera_estimation.hpp +++ b/include/eos/fitting/affine_camera_estimation.hpp @@ -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 */ diff --git a/include/eos/fitting/closest_edge_fitting.hpp b/include/eos/fitting/closest_edge_fitting.hpp index b2ee85751..c7fa3ddd0 100644 --- a/include/eos/fitting/closest_edge_fitting.hpp +++ b/include/eos/fitting/closest_edge_fitting.hpp @@ -127,7 +127,7 @@ inline std::vector occluding_boundary_vertices(const core::Mesh& mesh, { // Rotate the mesh: std::vector 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)); }); diff --git a/include/eos/fitting/contour_correspondence.hpp b/include/eos/fitting/contour_correspondence.hpp index 96a859b3d..2d8f105c6 100644 --- a/include/eos/fitting/contour_correspondence.hpp +++ b/include/eos/fitting/contour_correspondence.hpp @@ -336,7 +336,7 @@ get_nearest_contour_correspondences(const core::LandmarkCollection // 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& e) { return e.name == ibug_idx; }); // => this can go outside the loop if (result == std::end(landmarks)) diff --git a/include/eos/fitting/fitting.hpp b/include/eos/fitting/fitting.hpp index 991630557..979e92a7f 100644 --- a/include/eos/fitting/fitting.hpp +++ b/include/eos/fitting/fitting.hpp @@ -173,7 +173,10 @@ inline Eigen::VectorXf fit_shape(Eigen::Matrix affine_camera_matrix * @return A tuple of [image_points, model_points, vertex_indices]. */ template -inline auto get_corresponding_pointset(const T& landmarks, const core::LandmarkMapper& landmark_mapper, + inline std::tuple, + std::vector, + std::vector> + get_corresponding_pointset(const T& landmarks, const core::LandmarkMapper& landmark_mapper, const morphablemodel::MorphableModel& morphable_model) { using Eigen::Vector2f; @@ -213,7 +216,7 @@ inline auto get_corresponding_pointset(const T& landmarks, const core::LandmarkM * @return The concatenated vector. */ template -inline auto concat(const std::vector& vec_a, const std::vector& vec_b) +inline std::vector concat(const std::vector& vec_a, const std::vector& vec_b) { std::vector concatenated_vec; concatenated_vec.reserve(vec_a.size() + vec_b.size()); @@ -389,14 +392,14 @@ inline std::pair 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& 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& lm) { occluding_contour_landmarks.push_back({lm.coordinates[0], lm.coordinates[1]}); }); } diff --git a/include/eos/fitting/multi_image_fitting.hpp b/include/eos/fitting/multi_image_fitting.hpp index d4878bdeb..31485a0f2 100644 --- a/include/eos/fitting/multi_image_fitting.hpp +++ b/include/eos/fitting/multi_image_fitting.hpp @@ -261,7 +261,7 @@ inline std::pair, std::vector& lm) { occluding_contour_landmarks.push_back({lm.coordinates[0], lm.coordinates[1]}); }); } else @@ -269,7 +269,7 @@ inline std::pair, std::vector& lm) { occluding_contour_landmarks.push_back({lm.coordinates[0], lm.coordinates[1]}); }); } diff --git a/include/eos/morphablemodel/MorphableModel.hpp b/include/eos/morphablemodel/MorphableModel.hpp index fa7cad9c8..757b667b0 100644 --- a/include/eos/morphablemodel/MorphableModel.hpp +++ b/include/eos/morphablemodel/MorphableModel.hpp @@ -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. } } diff --git a/include/eos/render/FragmentShader.hpp b/include/eos/render/FragmentShader.hpp index 7e0d56f8a..d643a251e 100644 --- a/include/eos/render/FragmentShader.hpp +++ b/include/eos/render/FragmentShader.hpp @@ -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 pixel_color = glm::tvec3(texture_color[2], texture_color[1], texture_color[0]); return glm::tvec4(pixel_color, T(1)); }; diff --git a/include/eos/render/SoftwareRenderer.hpp b/include/eos/render/SoftwareRenderer.hpp index 7b93c532a..f43e8a7d6 100644 --- a/include/eos/render/SoftwareRenderer.hpp +++ b/include/eos/render/SoftwareRenderer.hpp @@ -351,7 +351,7 @@ class SoftwareRenderer * @param[in] plane_normal X. * @ return X. */ -template +template std::vector> clip_polygon_to_plane_in_4d(const std::vector>& vertices, const glm::tvec4& plane_normal) diff --git a/include/eos/render/render.hpp b/include/eos/render/render.hpp index ca7c909d5..6e389948a 100644 --- a/include/eos/render/render.hpp +++ b/include/eos/render/render.hpp @@ -147,7 +147,7 @@ render(core::Mesh mesh, glm::tmat4x4 model_view_matrix, glm::tmat4x4::max(); }); + [](double& element) { element = std::numeric_limits::max(); }); // Vertex shader: // processedVertex = shade(Vertex); // processedVertex : pos, col, tex, texweight diff --git a/include/eos/render/render_affine.hpp b/include/eos/render/render_affine.hpp index 70b8bd98e..392b52998 100644 --- a/include/eos/render/render_affine.hpp +++ b/include/eos/render/render_affine.hpp @@ -81,7 +81,7 @@ inline std::pair 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::max(); }); + [](double& element) { element = std::numeric_limits::max(); }); const Eigen::Matrix affine_with_z = detail::calculate_affine_z_direction(affine_camera_matrix); diff --git a/include/eos/render/texture_extraction.hpp b/include/eos/render/texture_extraction.hpp index 5784e6c18..d1e1b0ed9 100644 --- a/include/eos/render/texture_extraction.hpp +++ b/include/eos/render/texture_extraction.hpp @@ -72,7 +72,7 @@ namespace render { * cij - matrix coefficients */ // Note: The original functions used doubles. -Eigen::Matrix get_affine_transform(const std::array& src, +inline Eigen::Matrix get_affine_transform(const std::array& src, const std::array& dst) { using Eigen::Matrix; diff --git a/include/eos/video/Keyframe.hpp b/include/eos/video/Keyframe.hpp index dbd36f642..5ee430428 100644 --- a/include/eos/video/Keyframe.hpp +++ b/include/eos/video/Keyframe.hpp @@ -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{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>& lhs, + const std::vector>& rhs) { return lhs.score > rhs.score; }); bins[idx].resize(frames_per_bin); } return true; diff --git a/include/eos/video/keyframe_merging.hpp b/include/eos/video/keyframe_merging.hpp index 84938da75..18c0c214b 100644 --- a/include/eos/video/keyframe_merging.hpp +++ b/include/eos/video/keyframe_merging.hpp @@ -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"