fixed some functions' arguments, inlined some other simple functions

This commit is contained in:
Phuntsok Drak-pa
2019-04-25 02:53:30 +02:00
parent 8ec3db2450
commit 0aa81fdec0
2 changed files with 49 additions and 59 deletions

View File

@@ -103,35 +103,6 @@ ImageManipulator::ImageManipulator(cv::Mat const& t_origin_image,
}
}
// operators //////////////////////////////////////////////////////////////////
/**
* Copy assignment operator, will copy all of the inputs members except for
* its mutex, a new one will be generated.
*
* \param[in] other Element to copy
* \return ImageManipulator
*/
[[nodiscard]] auto ImageManipulator::operator=(const ImageManipulator& other)
-> ImageManipulator
{
return ImageManipulator(other);
}
/**
* Move assignment operator, will move all of the inputs members except for
* its mutex, a new one will be generated.
*
* \param[in] other Element to move
* \return ImageManipulator
*/
[[nodiscard]] auto ImageManipulator::operator=(
ImageManipulator&& other) noexcept -> ImageManipulator
{
return ImageManipulator{std::move(other)};
}
// public methods /////////////////////////////////////////////////////////////
/**
@@ -180,15 +151,6 @@ void ImageManipulator::exec_method(int const t_nb_method,
}
}
/**
* Write the generated image as a file to the specified path stored in the
* object
*/
void ImageManipulator::write_file() const
{
cv::imwrite(output_path_, generated_image_);
}
///////////////////////////////////////////////////////////////////////////////
// Private //
///////////////////////////////////////////////////////////////////////////////
@@ -345,7 +307,7 @@ void ImageManipulator::get_color_set()
* colors_, then resumes the other threads. Helper function for \ref
* get_color_set
*/
void ImageManipulator::threaded_get_color(int t_h)
void ImageManipulator::threaded_get_color(int const t_h)
{
if (t_h > reference_.size().height) {
return;
@@ -412,26 +374,24 @@ void ImageManipulator::update_gen_image(cv::Mat const& t_img,
* \param t_tiles Collection of tiles to be merged together
*/
void ImageManipulator::merge_tiles(
std::vector<std::vector<ImageManipulator>> t_tiles)
std::vector<std::vector<ImageManipulator>> const& t_tiles)
{
std::vector<cv::Mat> columns{};
for (auto const& col : t_tiles) {
std::for_each(t_tiles.begin(), t_tiles.end(), [&columns](auto const& col) {
std::vector<cv::Mat> column_arr{};
cv::Mat column_img{};
for (auto const& tile : col) {
std::for_each(col.begin(), col.end(), [&column_arr](auto const& tile) {
column_arr.push_back(tile.get_generated_image());
}
});
vconcat(column_arr, column_img);
columns.push_back(std::move(column_img));
}
});
hconcat(columns, generated_image_);
}
void ImageManipulator::method1()
{
spdlog::debug("Beginning method1, initial difference: {}", diff_);
spdlog::debug("nb_total_iter: {}, nb_remaining_iter: {}", total_iterations_,
remaining_iter_);
while (remaining_iter_ > 0 && diff_ > 0.0) {
auto temp_image = generated_image_.clone();
auto const [rand_x, rand_y, size] = get_square_values();