feat: 优化 项目目录结构
This commit is contained in:
@@ -2,12 +2,12 @@ use std::fs;
|
||||
use std::path::Path;
|
||||
use image::Rgb;
|
||||
use ddddocr_rs::{DdddOcr, DdddOcrBuilder}; // 假设你的包名是这个
|
||||
use ddddocr_rs::slide_model::Slide;
|
||||
use ddddocr_rs::models::slide::Slide;
|
||||
fn load_image<P: AsRef<Path>>(path: P) -> anyhow::Result<image::DynamicImage> {
|
||||
// 1. 先将泛型转为具体的 &Path 引用
|
||||
let path_ref = path.as_ref();
|
||||
|
||||
// 2. 调用 open 时传入引用(image::open 支持 AsRef<Path>)
|
||||
// 2. 调用 open 时传入引用(utils::open 支持 AsRef<Path>)
|
||||
image::open(path_ref)
|
||||
.map_err(|e| {
|
||||
// 3. 此时 path_ref 依然有效,可以安全地在闭包中使用
|
||||
@@ -102,7 +102,7 @@ fn test_real_slide_match() {
|
||||
// 2. 执行匹配
|
||||
// 如果是那种带有明显阴影边缘的复杂滑块,建议 simple_target 传 false
|
||||
let start = std::time::Instant::now();
|
||||
let result = engine.slide_match(&target_img, &bg_img, true)
|
||||
let result = engine.slide_match(&target_img, &bg_img, false)
|
||||
.expect("Slide match 执行失败");
|
||||
let duration = start.elapsed();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user