Don't forget to check the blacklist

This commit is contained in:
augustin64 2025-04-01 11:59:14 +02:00
parent 964d597bdd
commit b99ee153f0

View File

@ -220,7 +220,7 @@ void seam_carving(unsigned char* source, int width, int height, int nbChannels,
if (test_energy) { // Update blacklist
for (auto i=0; i < dim_long; i++) {
int j, cur_j = 0; // cur_j is the index relative to the current carved image. j is absolute in the source image
for (j=0; j < dim_large && cur_j < opt_seam[i]; j++) {
for (j=0; j < dim_large && (cur_j < opt_seam[i] || complete_blacklist[im_index(i, j)]); j++) {
if (!complete_blacklist[im_index(i, j)]) { cur_j++; }
}
assert(cur_j == opt_seam[i]); // Else, j == width and cur_j is not in the source image..