correction du bug: test-energy fonctionn
This commit is contained in:
parent
1918b7bea4
commit
916e3fa414
@ -280,7 +280,7 @@ void seam_carving(unsigned char *source, int width, int height, int nbChannels,
|
|||||||
|
|
||||||
//* Prepare final output
|
//* Prepare final output
|
||||||
|
|
||||||
float max_energy = __FLT_MAX__;
|
float max_energy = __FLT_MIN__;
|
||||||
for (auto k = 0; k < width * height; k++) {
|
for (auto k = 0; k < width * height; k++) {
|
||||||
max_energy = fmax(max_energy, ini_energy[k]);
|
max_energy = fmax(max_energy, ini_energy[k]);
|
||||||
}
|
}
|
||||||
@ -289,14 +289,15 @@ void seam_carving(unsigned char *source, int width, int height, int nbChannels,
|
|||||||
ini_energy[k] /= max_energy;
|
ini_energy[k] /= max_energy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << "toto" << std::endl;
|
||||||
for (auto k = 0; k < width * height; k++) {
|
for (auto k = 0; k < width * height; k++) {
|
||||||
// for (auto i=0; i < nbColorChannels; i++) //* Uncomment if you prefer to
|
// for (auto i=0; i < nbColorChannels; i++) //* Uncomment if you prefer to
|
||||||
// see darkened source image
|
// see darkened source image
|
||||||
// output[nbChannels*k+i] = source_img[nbChannels*k+i]/nbChannels;
|
// output[nbChannels*k+i] = source_img[nbChannels*k+i]/nbChannels;
|
||||||
|
|
||||||
for (auto i = 0; i < nbColorChannels; i++)
|
for (auto ch = 0; ch < nbColorChannels; ch++) {
|
||||||
test_energy_output[nbChannels * k + i] = ini_energy[k] * 255;
|
test_energy_output[nbChannels * k + ch] = ini_energy[k] * 255;
|
||||||
|
}
|
||||||
if (nbChannels == 4)
|
if (nbChannels == 4)
|
||||||
test_energy_output[nbChannels * k + 3] = source_img[nbChannels * k + 3];
|
test_energy_output[nbChannels * k + 3] = source_img[nbChannels * k + 3];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user