Oops, recompute energy in the good element

This commit is contained in:
augustin64 2025-04-04 08:36:11 +02:00
parent dd513122de
commit 46f1ad4dad

View File

@ -277,7 +277,7 @@ void recompute_energy_along_seam(
if ((0 < (opt_seam[j] + i)) && ((opt_seam[j] + i) < dim_large - 1)) { if ((0 < (opt_seam[j] + i)) && ((opt_seam[j] + i) < dim_large - 1)) {
compute_energy_for_pixel(carved_img, newWidth, newHeight, x, y, compute_energy_for_pixel(carved_img, newWidth, newHeight, x, y,
nbChannels, nbColorChannels, nbChannels, nbColorChannels,
output_energy[width * y + x].first); output_energy[width * y + x].second);
} }
} }
} }
@ -438,9 +438,7 @@ auto seam_carving(unsigned char *source, int width, int height, int nbChannels,
std::cout << std::endl; // Add newline after ProgressBar std::cout << std::endl; // Add newline after ProgressBar
if (test_energy) { if (test_energy) {
return std::make_tuple(test_energy_output, width, height, nbChannels); return std::make_tuple(test_energy_output, width, height, nbChannels);
} else { } else {
return std::make_tuple(source_img, curWidth, curHeight, nbChannels); return std::make_tuple(source_img, curWidth, curHeight, nbChannels);
} }