diff --git a/src/seam-carving.cpp b/src/seam-carving.cpp index 34d06e7..484ab07 100644 --- a/src/seam-carving.cpp +++ b/src/seam-carving.cpp @@ -195,11 +195,11 @@ std::vector carving_step(const std::vector source_img, std::vector &output_img, std::vector &output_energy, int width, int height, int nbChannels, int nbColorChannels, - bool vertical) { + bool vertical, int max_step=1) { /** Carves an image and its energy by one seam, and recomputes the energy. Returns the optimal seam used */ std::vector opt_seam = - optimal_seam(source_energy, width, height, vertical); + optimal_seam(source_energy, width, height, vertical,max_step=max_step); remove_seam(source_img, output_img, width, height, nbChannels, vertical, opt_seam); @@ -308,7 +308,7 @@ void seam_carving(unsigned char *source, int width, int height, int nbChannels, for (auto seam_index = 0; seam_index < nbSeams; seam_index++) { std::vector opt_seam = carving_step( source_img, source_energy, output_img, output_energy, curWidth, - curHeight, nbChannels, nbColorChannels, vertical); + curHeight, nbChannels, nbColorChannels, vertical, max_step=max_step); std::copy(output_img.begin(), output_img.end(), source_img.begin()); std::copy(output_energy.begin(), output_energy.end(), source_energy.begin());