l'argument max-step est repris en compte

This commit is contained in:
François Colin de Verdière 2025-04-01 17:52:56 +02:00
parent 916e3fa414
commit be328c464c

View File

@ -195,11 +195,11 @@ std::vector<int> carving_step(const std::vector<unsigned char> source_img,
std::vector<unsigned char> &output_img, std::vector<unsigned char> &output_img,
std::vector<float> &output_energy, int width, std::vector<float> &output_energy, int width,
int height, int nbChannels, int nbColorChannels, 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. /** Carves an image and its energy by one seam, and recomputes the energy.
Returns the optimal seam used */ Returns the optimal seam used */
std::vector<int> opt_seam = std::vector<int> 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, remove_seam(source_img, output_img, width, height, nbChannels, vertical,
opt_seam); 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++) { for (auto seam_index = 0; seam_index < nbSeams; seam_index++) {
std::vector<int> opt_seam = carving_step( std::vector<int> opt_seam = carving_step(
source_img, source_energy, output_img, output_energy, curWidth, 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_img.begin(), output_img.end(), source_img.begin());
std::copy(output_energy.begin(), output_energy.end(), std::copy(output_energy.begin(), output_energy.end(),
source_energy.begin()); source_energy.begin());