Skip to content

Commit

Permalink
Merge pull request #354 from oddkiva/maint-deduplicate-code
Browse files Browse the repository at this point in the history
MAINT: deduplicate code.
  • Loading branch information
oddkiva authored Oct 29, 2023
2 parents dac2a7e + dcfbdb8 commit 63b8e34
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 34 deletions.
5 changes: 0 additions & 5 deletions cpp/drafts/ChessboardDetection/EdgeStatistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
#include <DO/Sara/ImageProcessing/EdgeShapeStatistics.hpp>


inline constexpr auto operator"" _percent(long double x) -> long double
{
return x / 100;
}

namespace DO::Sara {

auto is_strong_edge(const ImageView<float>& grad_mag,
Expand Down
6 changes: 0 additions & 6 deletions cpp/examples/Sara/FeatureDetectors/edge_detection_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ using namespace std;
using namespace DO::Sara;


inline constexpr long double operator"" _percent(long double x)
{
return x / 100;
}


auto is_strong_edge(const ImageView<float>& grad_mag,
const std::vector<Eigen::Vector2i>& edge,
const float grad_thres) -> float
Expand Down
6 changes: 0 additions & 6 deletions cpp/examples/Sara/FeatureMatching/video_edge_matching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ using namespace std;
using namespace DO::Sara;


inline constexpr long double operator"" _percent(long double x)
{
return x / 100;
}


auto initialize_camera_intrinsics_1()
{
auto intrinsics = BrownConradyCamera32<float>{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ namespace po = boost::program_options;
using namespace DO::Sara;


inline constexpr long double operator"" _percent(long double x)
{
return x / 100;
}


auto initialize_camera_intrinsics_1()
{
auto intrinsics = BrownConradyCamera32<float>{};
Expand Down Expand Up @@ -239,13 +233,13 @@ int sara_graphics_main(int argc, char** argv)

// Output save.
const auto basename = fs::path(video_filepath).stem().string();
VideoWriter video_writer{
const auto output_file =
#if defined(__APPLE__)
"/Users/david/Desktop/" + basename + ".ortho-vp.mp4",
"/Users/david/Desktop/" + basename + ".ortho-vp.mp4";
#else
"/home/david/Desktop/" + basename + ".ortho-vp.mp4",
"/home/david/Desktop/" + basename + ".ortho-vp.mp4";
#endif
frame.sizes()};
auto video_writer = VideoWriter{output_file, frame.sizes()};


// Show the local extrema.
Expand Down
14 changes: 13 additions & 1 deletion cpp/src/DO/Sara/Core/PhysicalQuantities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,19 @@ namespace DO::Sara {
-> PixelUnits<2>
{
const auto ratio = sensor_sizes.cast<long double>() / focal_length.value;
return image_sizes.cast<long double>().cwiseProduct(ratio).cast<PixelUnit>();
return image_sizes.cast<long double>()
.cwiseProduct(ratio)
.cast<PixelUnit>();
}

} // namespace DO::Sara


namespace DO::Sara {

inline constexpr auto operator"" _percent(long double x) -> long double
{
return x / 100;
}

} // namespace DO::Sara
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ namespace v2 {
} // namespace v2


inline constexpr long double operator"" _percent(long double x)
{
return x / 100;
}


int main(int argc, char** argv)
{
DO::Sara::GraphicsApplication app(argc, argv);
Expand Down

0 comments on commit 63b8e34

Please sign in to comment.