refactor(classify): 重构图片明暗分类逻辑

- 移除固定的明暗阈值等级数组,改用动态分档机制
- 引入 neutralMargin 常量,当两分差幅小于 0.15 时视为中性图
- 修改 BrightnessName 函数,实现三分法分类:bright_N、dark_N、mid
- 新增 brightnessTier 辅助函数,将占比分档到最接近的 10%
- 完全透明的像素(alpha=0)不再参与明暗统计计算
- 更新错误提示信息,明暗分析失败时按中性 mid 归类
- 调整 README 文档描述,同步更新明暗分类规则说明
This commit is contained in:
2025-04-01 21:07:48 +08:00
parent 99b9460bcd
commit 13bb195e1d
5 changed files with 40 additions and 45 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ func (o *Organizer) ProcessImages(images []scanner.File) {
if !strings.EqualFold(f.Ext, ".gif") {
dark, light, berr := probe.AnalyzeBrightness(f.Path)
if berr != nil {
fmt.Printf("=== 明暗分析失败(按默认dark_55归类): %s \n", f.Path)
fmt.Printf("=== 明暗分析失败(按中性mid归类): %s \n", f.Path)
} else {
darkScore, lightScore = dark, light
}