Skip to content

Commit b71c5ea

Browse files
committed
Removed more occurrences of eos::cpp17
1 parent d452503 commit b71c5ea

File tree

7 files changed

+21
-139
lines changed

7 files changed

+21
-139
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ source_group(render REGULAR_EXPRESSION include/eos/render/*)
140140
source_group(render\\detail REGULAR_EXPRESSION include/eos/render/detail/*)
141141
source_group(render\\opencv REGULAR_EXPRESSION include/eos/render/opencv/*)
142142
source_group(video REGULAR_EXPRESSION include/eos/video/*)
143-
source_group(cpp17 REGULAR_EXPRESSION include/eos/cpp17/*)
144-
source_group(cpp17\\detail REGULAR_EXPRESSION include/eos/cpp17/detail/*)
145143

146144
# The eos install target:
147145
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include) # our library headers

include/eos/fitting/multi_image_fitting.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace fitting {
5757
* starting values in the fitting. When the function returns, they contain the coefficients from
5858
* the last iteration.
5959
*
60-
* Use render::Mesh fit_shape_and_pose(const morphablemodel::MorphableModel&, const std::vector<morphablemodel::Blendshape>&, const core::LandmarkCollection<Eigen::Vector2f>&, const core::LandmarkMapper&, int, int, const morphablemodel::EdgeTopology&, const fitting::ContourLandmarks&, const fitting::ModelContour&, int, cpp17::optional<int>, float).
60+
* Use render::Mesh fit_shape_and_pose(const morphablemodel::MorphableModel&, const std::vector<morphablemodel::Blendshape>&, const core::LandmarkCollection<Eigen::Vector2f>&, const core::LandmarkMapper&, int, int, const morphablemodel::EdgeTopology&, const fitting::ContourLandmarks&, const fitting::ModelContour&, int, std::optional<int>, float).
6161
* for a simpler overload with reasonable defaults and no optional output.
6262
*
6363
* \p num_iterations: Results are good for even a few iterations. For full convergence of all parameters,
@@ -344,7 +344,7 @@ inline std::pair<std::vector<core::Mesh>, std::vector<fitting::RenderingParamete
344344
*
345345
* If you want to access the values of shape or blendshape coefficients, or want to set starting
346346
* values for them, use the following overload to this function:
347-
* std::pair<render::Mesh, fitting::RenderingParameters> fit_shape_and_pose(const morphablemodel::MorphableModel&, const std::vector<morphablemodel::Blendshape>&, const core::LandmarkCollection<Eigen::Vector2f>&, const core::LandmarkMapper&, int, int, const morphablemodel::EdgeTopology&, const fitting::ContourLandmarks&, const fitting::ModelContour&, int, cpp17::optional<int>, float, cpp17::optional<fitting::RenderingParameters>, std::vector<float>&, std::vector<float>&, std::vector<Eigen::Vector2f>&)
347+
* std::pair<render::Mesh, fitting::RenderingParameters> fit_shape_and_pose(const morphablemodel::MorphableModel&, const std::vector<morphablemodel::Blendshape>&, const core::LandmarkCollection<Eigen::Vector2f>&, const core::LandmarkMapper&, int, int, const morphablemodel::EdgeTopology&, const fitting::ContourLandmarks&, const fitting::ModelContour&, int, std::optional<int>, float, std::optional<fitting::RenderingParameters>, std::vector<float>&, std::vector<float>&, std::vector<Eigen::Vector2f>&)
348348
*
349349
* \p num_iterations: Results are good for even a few iterations. For full convergence of all parameters,
350350
* it can take up to 300 iterations. In tracking, particularly if initialising with the previous frame,

include/eos/morphablemodel/io/cvssp.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#define EOS_IO_CVSSP_HPP
2424

2525
#include "eos/morphablemodel/MorphableModel.hpp"
26-
#include "eos/cpp17/optional.hpp"
2726

2827
#include "Eigen/Core"
2928

@@ -33,6 +32,7 @@
3332
#include <string>
3433
#include <sstream>
3534
#include <vector>
35+
#include <optional>
3636

3737
namespace eos {
3838
namespace morphablemodel {
@@ -62,7 +62,7 @@ std::vector<std::array<double, 2>> load_isomap(std::string isomap_file);
6262
* @throws std::runtime_error when reading either of the files fails.
6363
*/
6464
inline MorphableModel load_scm_model(std::string model_filename,
65-
cpp17::optional<std::string> isomap_file = cpp17::nullopt)
65+
std::optional<std::string> isomap_file = std::nullopt)
6666
{
6767
using Eigen::MatrixXf;
6868
using Eigen::VectorXf;
@@ -255,7 +255,7 @@ inline MorphableModel load_scm_model(std::string model_filename,
255255
}
256256
}
257257

258-
return MorphableModel(shape_model, color_model, cpp17::nullopt, tex_coords);
258+
return MorphableModel(shape_model, color_model, std::nullopt, tex_coords);
259259
};
260260

261261
/**

python/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pybind11_add_module(python-bindings generate-python-bindings.cpp pybind11_Image.hpp pybind11_optional.hpp pybind11_variant.hpp)
1+
pybind11_add_module(python-bindings generate-python-bindings.cpp pybind11_Image.hpp)
22
target_link_libraries(python-bindings PRIVATE eos)
33
set_target_properties(python-bindings PROPERTIES OUTPUT_NAME eos)
44

python/generate-python-bindings.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@
4141
#include "pybind11/eigen.h"
4242
#include "pybind11/stl.h"
4343

44-
#include "eos/cpp17/optional.hpp"
45-
#include "pybind11_optional.hpp"
46-
#include "pybind11_variant.hpp"
4744
#include "pybind11_Image.hpp"
4845

4946
#include "Eigen/Core"
5047

5148
#include <cassert>
5249
#include <string>
50+
#include <optional>
5351

5452
namespace py = pybind11;
5553
using namespace eos;
@@ -197,8 +195,8 @@ PYBIND11_MODULE(eos, eos_module)
197195
.value("PcaModel", morphablemodel::MorphableModel::ExpressionModelType::PcaModel);
198196

199197
morphable_model
200-
.def(py::init<morphablemodel::PcaModel, morphablemodel::PcaModel, cpp17::optional<std::unordered_map<std::string, int>>, std::vector<std::array<double, 2>>, std::vector<std::array<int, 3>>>(), "Create a Morphable Model from a shape and a colour PCA model, and optional vertex definitions and texture coordinates.", py::arg("shape_model"), py::arg("color_model"), py::arg("vertex_definitions") = cpp17::nullopt, py::arg("texture_coordinates") = std::vector<std::array<double, 2>>(), py::arg("texture_triangle_indices") = std::vector<std::array<int, 3>>())
201-
.def(py::init<morphablemodel::PcaModel, morphablemodel::ExpressionModel, morphablemodel::PcaModel, cpp17::optional<std::unordered_map<std::string, int>>, std::vector<std::array<double, 2>>, std::vector<std::array<int, 3>>>(), "Create a Morphable Model from a shape and a colour PCA model, an expression PCA model or blendshapes, and optional vertex definitions and texture coordinates.", py::arg("shape_model"), py::arg("expression_model"), py::arg("color_model"), py::arg("vertex_definitions") = cpp17::nullopt, py::arg("texture_coordinates") = std::vector<std::array<double, 2>>(), py::arg("texture_triangle_indices") = std::vector<std::array<int, 3>>())
198+
.def(py::init<morphablemodel::PcaModel, morphablemodel::PcaModel, std::optional<std::unordered_map<std::string, int>>, std::vector<std::array<double, 2>>, std::vector<std::array<int, 3>>>(), "Create a Morphable Model from a shape and a colour PCA model, and optional vertex definitions and texture coordinates.", py::arg("shape_model"), py::arg("color_model"), py::arg("vertex_definitions") = std::nullopt, py::arg("texture_coordinates") = std::vector<std::array<double, 2>>(), py::arg("texture_triangle_indices") = std::vector<std::array<int, 3>>())
199+
.def(py::init<morphablemodel::PcaModel, morphablemodel::ExpressionModel, morphablemodel::PcaModel, std::optional<std::unordered_map<std::string, int>>, std::vector<std::array<double, 2>>, std::vector<std::array<int, 3>>>(), "Create a Morphable Model from a shape and a colour PCA model, an expression PCA model or blendshapes, and optional vertex definitions and texture coordinates.", py::arg("shape_model"), py::arg("expression_model"), py::arg("color_model"), py::arg("vertex_definitions") = std::nullopt, py::arg("texture_coordinates") = std::vector<std::array<double, 2>>(), py::arg("texture_triangle_indices") = std::vector<std::array<int, 3>>())
202200
.def("get_shape_model", &morphablemodel::MorphableModel::get_shape_model, "Returns the PCA shape model of this Morphable Model.") // Not sure if that'll really be const in Python? I think Python does a copy each time this gets called?
203201
.def("get_color_model", &morphablemodel::MorphableModel::get_color_model, "Returns the PCA colour (albedo) model of this Morphable Model.")
204202
.def("get_expression_model", &morphablemodel::MorphableModel::get_expression_model, "Returns the shape expression model or an empty optional if the Morphable Model does not have a separate expression model.")
@@ -245,7 +243,7 @@ PYBIND11_MODULE(eos, eos_module)
245243
morphablemodel_module.def("load_scm_model", &morphablemodel::load_scm_model,
246244
"Load a shape and color model from a .scm file containing a Morphable Model in "
247245
"the Surrey CVSSP binary format.",
248-
py::arg("model_filename"), py::arg("isomap_file") = cpp17::nullopt);
246+
py::arg("model_filename"), py::arg("isomap_file") = std::nullopt);
249247

250248
/**
251249
* Bindings for the eos::pca namespace:
@@ -317,9 +315,9 @@ PYBIND11_MODULE(eos, eos_module)
317315
const core::LandmarkMapper& landmark_mapper, int image_width, int image_height,
318316
const morphablemodel::EdgeTopology& edge_topology,
319317
const fitting::ContourLandmarks& contour_landmarks, const fitting::ModelContour& model_contour,
320-
int num_iterations, cpp17::optional<int> num_shape_coefficients_to_fit, float lambda_identity,
321-
cpp17::optional<int> num_expression_coefficients_to_fit,
322-
cpp17::optional<float> lambda_expressions) {
318+
int num_iterations, std::optional<int> num_shape_coefficients_to_fit, float lambda_identity,
319+
std::optional<int> num_expression_coefficients_to_fit,
320+
std::optional<float> lambda_expressions) {
323321
std::vector<float> pca_coeffs;
324322
std::vector<float> blendshape_coeffs;
325323
std::vector<Eigen::Vector2f> fitted_image_points;
@@ -343,9 +341,9 @@ PYBIND11_MODULE(eos, eos_module)
343341
[](const morphablemodel::MorphableModel& morphable_model,
344342
const core::LandmarkCollection<Eigen::Vector2f>& landmarks,
345343
const core::LandmarkMapper& landmark_mapper, int image_width, int image_height,
346-
int num_iterations, cpp17::optional<int> num_shape_coefficients_to_fit, float lambda_identity,
347-
cpp17::optional<int> num_expression_coefficients_to_fit,
348-
cpp17::optional<float> lambda_expressions,
344+
int num_iterations, std::optional<int> num_shape_coefficients_to_fit, float lambda_identity,
345+
std::optional<int> num_expression_coefficients_to_fit,
346+
std::optional<float> lambda_expressions,
349347
std::vector<float> pca_coeffs,
350348
std::vector<float> blendshape_coeffs,
351349
std::vector<Eigen::Vector2f> fitted_image_points) {
@@ -370,9 +368,9 @@ PYBIND11_MODULE(eos, eos_module)
370368
[](const morphablemodel::PcaModel& shape_model,
371369
const Eigen::Matrix<float, 3, 4>& affine_camera_matrix,
372370
const std::vector<Eigen::Vector2f>& landmarks, const std::vector<int>& vertex_ids,
373-
const Eigen::VectorXf& base_face, float lambda, cpp17::optional<int> num_coefficients_to_fit,
374-
cpp17::optional<float> detector_standard_deviation,
375-
cpp17::optional<float> model_standard_deviation) {
371+
const Eigen::VectorXf& base_face, float lambda, std::optional<int> num_coefficients_to_fit,
372+
std::optional<float> detector_standard_deviation,
373+
std::optional<float> model_standard_deviation) {
376374
const auto result = fitting::fit_shape_to_landmarks_linear(
377375
shape_model, affine_camera_matrix, landmarks, vertex_ids, base_face, lambda,
378376
num_coefficients_to_fit, detector_standard_deviation, model_standard_deviation);
@@ -391,8 +389,8 @@ PYBIND11_MODULE(eos, eos_module)
391389
[](const morphablemodel::ExpressionModel& expression_model, const Eigen::VectorXf& face_instance,
392390
const Eigen::Matrix<float, 3, 4>& affine_camera_matrix,
393391
const std::vector<Eigen::Vector2f>& landmarks, const std::vector<int>& vertex_ids,
394-
cpp17::optional<float> lambda_expressions,
395-
cpp17::optional<int> num_expression_coefficients_to_fit) {
392+
std::optional<float> lambda_expressions,
393+
std::optional<int> num_expression_coefficients_to_fit) {
396394
const auto result =
397395
fitting::fit_expressions(expression_model, face_instance, affine_camera_matrix, landmarks,
398396
vertex_ids, lambda_expressions, num_expression_coefficients_to_fit);

python/pybind11_optional.hpp

Lines changed: 0 additions & 57 deletions
This file was deleted.

python/pybind11_variant.hpp

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)