refactor: ZXing对齐 — 容差50pct + 几何验证 + end-based中心 + 废弃代码清理
- detect.rs: 容差从40%提升到50% (对齐ZXing的moduleSize/2) - detect.rs: 中心点改用ZXing end-based公式 (浮点精度, end - r4 - r3 - r2/2) - detect.rs: 新增validate_finder_geometry()几何验证 module_size一致性<10% + 勾股定理偏差<15% - detect.rs: compute_finder_deviation改用base=total/7 - detect.rs: 删除废弃的estimate_finder_size函数 - perspective.rs: count_finder_hits容差对齐 (base=total/7 + 50pct) - web/main.rs + cli/main.rs: 修复Rust 1.96新版clippy规则
This commit is contained in:
+1
-2
@@ -69,7 +69,7 @@ fn generate_qr_inner(text: &str, level_str: &str, margin: u8, size: u8, fmt: &st
|
||||
if margin > 20 {
|
||||
return (StatusCode::BAD_REQUEST, "边距过大(最大 20)").into_response();
|
||||
}
|
||||
if size < 1 || size > 20 {
|
||||
if !(1..=20).contains(&size) {
|
||||
return (StatusCode::BAD_REQUEST, "模块大小需在 1-20 之间").into_response();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ fn generate_qr_inner(text: &str, level_str: &str, margin: u8, size: u8, fmt: &st
|
||||
level,
|
||||
version: VersionMode::Auto,
|
||||
margin,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let qr = match QrCode::encode(text, config) {
|
||||
|
||||
Reference in New Issue
Block a user