Files
hcie-rust-v3.05/hcie-io/examples/inspect_diff.rs
T
phantom 9388e6f096 GOOD Refactor GUI components and add PlainSlider widget
- Added a new `PlainSlider` widget for keyboard-editable numeric sliders.
- Updated various panels to utilize the new `PlainSlider` for better user interaction.
- Removed unused code and dead code warnings across multiple files.
- Improved organization of modules by adding a `widgets` module.
- Cleaned up imports in several files to streamline the codebase.
- Added Qodana configuration file for code analysis and quality checks.
2026-07-19 00:55:40 +03:00

37 lines
1.1 KiB
Rust

fn main() {
let ref_img = image::open("_images/_psd_stil_test/test_2/Emboss.png")
.unwrap()
.to_rgba8();
let test_img = image::open("/tmp/test2_Emboss.png").unwrap().to_rgba8();
let mut diff_sum = 0.0;
let mut max_diff = 0;
let mut px = 0;
let mut printed = 0;
for y in 0..ref_img.height() {
for x in 0..ref_img.width() {
let rp = ref_img.get_pixel(x, y);
let tp = test_img.get_pixel(x, y);
let d = (rp[0] as i32 - tp[0] as i32).abs()
+ (rp[1] as i32 - tp[1] as i32).abs()
+ (rp[2] as i32 - tp[2] as i32).abs()
+ (rp[3] as i32 - tp[3] as i32).abs();
diff_sum += d as f64;
max_diff = max_diff.max(d);
px += 4;
if d > 100 && printed < 20 {
println!("x: {}, y: {} | REF: {:?} | TEST: {:?}", x, y, rp, tp);
printed += 1;
}
}
}
println!("Avg diff per channel: {:.2}", diff_sum / px as f64);
println!("Max pixel diff: {}", max_diff);
}