changed function signature (best practices)
This commit is contained in:
parent
fe530235a2
commit
99c815a561
@ -5,10 +5,10 @@
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
void method1(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations);
|
||||
void method1(cv::Mat const &, cv::Mat &, int);
|
||||
|
||||
void method2(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations);
|
||||
void method2(cv::Mat const &, cv::Mat &, int);
|
||||
|
||||
void method3(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations);
|
||||
void method3(cv::Mat const &, cv::Mat &, int);
|
||||
|
||||
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_METHODS_HH_ */
|
||||
|
@ -40,7 +40,7 @@ void newSquare1(cv::Mat &t_process_img, cv::Point &&t_top_left, int t_size) {
|
||||
draw_shape(t_process_img, t_top_left, t_size, randomColor(), Shapes::Square);
|
||||
}
|
||||
|
||||
void threadedGetColor(cv::Mat &t_reference, ColorSet &t_colors, int t_h) {
|
||||
void threadedGetColor(cv::Mat const &t_reference, ColorSet &t_colors, int t_h) {
|
||||
if (t_h > t_reference.size().height)
|
||||
return;
|
||||
for (int w = 0; w < t_reference.size().width; w += 3) {
|
||||
@ -56,7 +56,7 @@ void threadedGetColor(cv::Mat &t_reference, ColorSet &t_colors, int t_h) {
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ColorSet getColorSet(cv::Mat &t_reference) {
|
||||
[[nodiscard]] ColorSet getColorSet(cv::Mat const &t_reference) {
|
||||
ColorSet res{};
|
||||
for (int h = 0; h < t_reference.size().height; h += thread_nbr) {
|
||||
std::vector<std::thread> thread_list{};
|
||||
@ -83,7 +83,7 @@ void newSquare2(cv::Mat &t_process_img, cv::Point &&t_top_left, int t_size,
|
||||
|
||||
} // namespace methods_private
|
||||
|
||||
void method1(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
void method1(cv::Mat const &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
auto diff = euclidian_distance(t_reference, t_output);
|
||||
spdlog::debug("Beginning method1, initial difference: {}", diff);
|
||||
while (t_iterations > 0 && diff >= 0) {
|
||||
@ -103,7 +103,7 @@ void method1(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
}
|
||||
}
|
||||
|
||||
void method2(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
void method2(cv::Mat const &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
auto diff = euclidian_distance(t_reference, t_output);
|
||||
spdlog::debug("Beginning method2, initial difference: {}", diff);
|
||||
spdlog::debug("Running {} threads.", thread_nbr);
|
||||
@ -128,7 +128,7 @@ void method2(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
}
|
||||
}
|
||||
|
||||
void method3(cv::Mat &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
void method3(cv::Mat const &t_reference, cv::Mat &t_output, int t_iterations) {
|
||||
auto const init_iter = t_iterations;
|
||||
auto diff = euclidian_distance(t_reference, t_output);
|
||||
spdlog::debug("Beginning method2, initial difference: {}", diff);
|
||||
|
@ -21,13 +21,14 @@ void processFilenames(po::variables_map const &vm, path const &t_input,
|
||||
[[nodiscard]] std::tuple<path, path, int, int, bool> parse_args(int t_ac,
|
||||
char **t_av) {
|
||||
po::options_description desc("Allowed options");
|
||||
desc.add_options()("help,h", "Display this help message")(
|
||||
"input,i", po::value<path>(),
|
||||
"Input image")("output,o", po::value<path>(),
|
||||
"Image output path (default: input path + \"_output\")")(
|
||||
"method,m", po::value<int>(), "Method number to be used (default: 1)")(
|
||||
"iterations,n", po::value<int>(),
|
||||
"Number of iterations (default: 5000)")("verbose,v", "Enables verbosity");
|
||||
desc.add_options()
|
||||
("help,h", "Display this help message")
|
||||
("input,i", po::value<path>(), "Input image")
|
||||
("output,o", po::value<path>(),
|
||||
"Image output path (default: input path + \"_output\")")
|
||||
("method,m", po::value<int>(), "Method number to be used (default: 1)")
|
||||
("iterations,n", po::value<int>(), "Number of iterations (default: 5000)")
|
||||
("verbose,v", "Enables verbosity");
|
||||
po::variables_map vm;
|
||||
po::store(po::parse_command_line(t_ac, t_av, desc), vm);
|
||||
po::notify(vm);
|
||||
|
Loading…
Reference in New Issue
Block a user