trailing types instead of return types

parent 8a215f4a
......@@ -7,9 +7,9 @@
#include <string>
#include <utility>
[[nodiscard]] std::pair<cv::Mat, cv::Mat> init_image(
std::string const&) noexcept;
[[nodiscard]] auto init_image(std::string const&) noexcept
-> std::pair<cv::Mat, cv::Mat>;
[[nodiscard]] double euclidian_distance(cv::Mat const&, cv::Mat const&);
[[nodiscard]] auto euclidian_distance(cv::Mat const&, cv::Mat const&) -> double;
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_COMMON_HH_ */
......@@ -4,8 +4,7 @@
#include <filesystem>
#include <tuple>
[[nodiscard]] std::
tuple<std::filesystem::path, std::filesystem::path, int, int, bool>
parse_args(int, char**);
[[nodiscard]] auto parse_args(int, char**)
-> std::tuple<std::filesystem::path, std::filesystem::path, int, int, bool>;
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_PARSEARGS_HH_ */
......@@ -3,8 +3,8 @@
#include <cmath>
#include <cstdlib>
[[nodiscard]] std::pair<cv::Mat, cv::Mat> init_image(
std::string const& t_input_file) noexcept
[[nodiscard]] auto init_image(std::string const& t_input_file) noexcept
-> std::pair<cv::Mat, cv::Mat>
{
cv::Mat input_image = cv::imread(t_input_file, cv::IMREAD_COLOR);
if (!input_image.data) {
......@@ -19,8 +19,8 @@
return std::make_pair(std::move(input_image), process_image);
}
[[nodiscard]] double euclidian_distance(cv::Mat const& t_img1,
cv::Mat const& t_img2)
[[nodiscard]] auto euclidian_distance(cv::Mat const& t_img1,
cv::Mat const& t_img2) -> double
{
double euclidian = 0.0;
for (auto itr1 = t_img1.begin<uchar>(), itr2 = t_img2.begin<uchar>();
......
......@@ -17,21 +17,21 @@ int main(int ac, char** av)
auto [input_image, process_image] = init_image(input_file.native());
switch (method) {
case 1: {
method1(input_image, process_image, iterations);
break;
}
case 2: {
method2(input_image, process_image, iterations);
break;
}
case 3: {
method3(input_image, process_image, iterations);
break;
}
default:
spdlog::error("Requested method {} is not implemented.");
std::exit(-1);
case 1: {
method1(input_image, process_image, iterations);
break;
}
case 2: {
method2(input_image, process_image, iterations);
break;
}
case 3: {
method3(input_image, process_image, iterations);
break;
}
default:
spdlog::error("Requested method {} is not implemented.");
std::exit(-1);
}
cv::imwrite(output_file.native(), process_image);
......
......@@ -31,7 +31,7 @@ void adjustSize(cv::Mat const& t_process_img, cv::Point& t_top_left, int size)
}
}
[[nodiscard]] cv::Scalar randomColor()
[[nodiscard]] auto randomColor() -> cv::Scalar
{
static std::uniform_int_distribution<> dis(0, 255);
return cv::Scalar(rand() % 255, rand() % 255, rand() % 255);
......@@ -60,12 +60,12 @@ void threadedGetColor(cv::Mat const& t_reference, ColorSet& t_colors, int t_h)
}
}
[[nodiscard]] ColorSet getColorSet(cv::Mat const& t_reference)
[[nodiscard]] auto getColorSet(cv::Mat const& t_reference) -> ColorSet
{
ColorSet res{};
for (int h = 0; h < t_reference.size().height; h += thread_nbr) {
std::vector<std::thread> thread_list{};
for (int i = 0; i < thread_nbr; ++i) {
for (auto i = 0u; i < thread_nbr; ++i) {
thread_list.push_back(std::thread(methods_private::threadedGetColor,
std::ref(t_reference), std::ref(res),
h + i));
......
......@@ -21,8 +21,8 @@ void processFilenames(po::variables_map const& vm,
}
}
[[nodiscard]] std::tuple<path, path, int, int, bool> parse_args(int t_ac,
char** t_av)
[[nodiscard]] auto parse_args(int t_ac, char** t_av)
-> std::tuple<path, path, int, int, bool>
{
po::options_description desc("Allowed options");
desc.add_options()("help,h", "Display this help message")(
......
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