renames resized image and fixes borrowing issue

This commit is contained in:
2024-05-12 13:15:13 +02:00
parent 13fd6d0635
commit fcfdf4add2
+4 -4
View File
@@ -38,7 +38,7 @@ impl DCT {
self
}
fn dct(&self, img: image::DynamicImage) -> [f64; 64] {
fn dct(&self, img: &image::DynamicImage) -> [f64; 64] {
let mut dct_values: [f64; 64] = [0.0; 64];
for u in 0..8 {
for v in 0..8 {
@@ -102,8 +102,8 @@ impl DCT {
impl Descriptor for DCT {
fn describe(&self, img: image::DynamicImage) -> u64 {
let img = self.resize(img);
let mut dct_values = self.dct(img);
let resized = self.resize(img);
let mut dct_values = self.dct(&resized);
debug!("DCT-coefficients:\n {}", print_matrix(dct_values));
// Quantization:
@@ -114,7 +114,7 @@ impl Descriptor for DCT {
debug!("DCT-coefficients, quantized:\n {}", print_matrix(dct_values));
if log_enabled!(Level::Debug) {
img.save("resize.png").expect("Error saving file");
resized.save("resize.png").expect("Error saving file");
// De-quantization:
for i in 0..64 {
dct_values[i] = dct_values[i] * self.quantization_matrix[i] as f64;