Fix pixel saturation in interpolate_quadratic (#2806)

* Fix pixel saturation in interpolate_quadratic

* Use pixel_type_t alias
This commit is contained in:
Adrià Arrufat 2023-06-02 10:52:11 +09:00 committed by GitHub
parent eccb9675ff
commit 759170d3d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -310,7 +310,9 @@ namespace dlib
pixel_to_vector<double>(img[r+1][c ])(i),
pixel_to_vector<double>(img[r+1][c+1])(i));
typename image_view_type::pixel_type temp;
vector_to_pixel(temp, pvout);
const auto min_val = pixel_traits<pixel_type_t<image_view_type>>::min();
const auto max_val = pixel_traits<pixel_type_t<image_view_type>>::max();
vector_to_pixel(temp, clamp(pvout, min_val, max_val));
assign_pixel(result, temp);
return true;
}