renames resized image and fixes borrowing issue
This commit is contained in:
@@ -38,7 +38,7 @@ impl DCT {
|
|||||||
self
|
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];
|
let mut dct_values: [f64; 64] = [0.0; 64];
|
||||||
for u in 0..8 {
|
for u in 0..8 {
|
||||||
for v in 0..8 {
|
for v in 0..8 {
|
||||||
@@ -102,8 +102,8 @@ impl DCT {
|
|||||||
|
|
||||||
impl Descriptor for DCT {
|
impl Descriptor for DCT {
|
||||||
fn describe(&self, img: image::DynamicImage) -> u64 {
|
fn describe(&self, img: image::DynamicImage) -> u64 {
|
||||||
let img = self.resize(img);
|
let resized = self.resize(img);
|
||||||
let mut dct_values = self.dct(img);
|
let mut dct_values = self.dct(&resized);
|
||||||
debug!("DCT-coefficients:\n {}", print_matrix(dct_values));
|
debug!("DCT-coefficients:\n {}", print_matrix(dct_values));
|
||||||
|
|
||||||
// Quantization:
|
// Quantization:
|
||||||
@@ -114,7 +114,7 @@ impl Descriptor for DCT {
|
|||||||
debug!("DCT-coefficients, quantized:\n {}", print_matrix(dct_values));
|
debug!("DCT-coefficients, quantized:\n {}", print_matrix(dct_values));
|
||||||
|
|
||||||
if log_enabled!(Level::Debug) {
|
if log_enabled!(Level::Debug) {
|
||||||
img.save("resize.png").expect("Error saving file");
|
resized.save("resize.png").expect("Error saving file");
|
||||||
// De-quantization:
|
// De-quantization:
|
||||||
for i in 0..64 {
|
for i in 0..64 {
|
||||||
dct_values[i] = dct_values[i] * self.quantization_matrix[i] as f64;
|
dct_values[i] = dct_values[i] * self.quantization_matrix[i] as f64;
|
||||||
|
|||||||
Reference in New Issue
Block a user