diff --git a/src/seam-carving.cpp b/src/seam-carving.cpp index a8605fa..8d8ace2 100644 --- a/src/seam-carving.cpp +++ b/src/seam-carving.cpp @@ -113,8 +113,27 @@ std::string function = "grad"; (fabs((float)source[indexPixel_right + ch] - \ source[indexPixel + ch])))); \ } \ + } else if (function == "sumexpgradcomp") { \ + \ + for (auto ch = 0; ch < (nbColorChannels); ch++) { \ + dest += (std::exp(fabs((float)source[indexPixel_up + ch] - \ + source[indexPixel + ch]) / \ + 255) + \ + \ + std::exp(fabs((float)source[indexPixel_down + ch] - \ + source[indexPixel + ch]) / \ + 255) + \ + \ + std::exp(fabs((float)source[indexPixel_left + ch] - \ + source[indexPixel + ch]) / \ + 255) + \ + std::exp(fabs((float)source[indexPixel_right + ch] - \ + source[indexPixel + ch]) / \ + 255)); \ + } \ } else { \ - std::cerr << "function " << function << " not available" << std::endl; \ + std::cerr << "no implementation found for function \"" << function << "\"" \ + << std::endl; \ exit(1); \ }; // Le alpha n'est pas pris en compte dans l'énergie