Sort pair only on seam value

This commit is contained in:
augustin64 2025-03-26 11:38:08 +01:00
parent 7446cabaad
commit b53e46d943

View File

@ -79,7 +79,8 @@ std::vector<int> optimal_vertical_seams(std::vector<unsigned char> energy, int w
for (auto j=0; j < width; j++) {
seamEnds[j] = {dyn_energy[(height-1)*width+j], j};
}
std::sort(seamEnds.begin(), seamEnds.end());
std::sort(seamEnds.begin(), seamEnds.end(),
[](std::pair<int, int> a, std::pair<int, int> b) {return a.first > b.first; });
for (auto seam=0; seam < nbSeams; seam++) {
result[height*(seam+1)-1] = seamEnds[seam].second;
}