Files
schisandra-album-cloud-micr…/common/clarity/clarity_test.go
2025-03-14 18:15:10 +08:00

31 lines
550 B
Go

package clarity
import (
"image"
_ "image/jpeg"
_ "image/png"
"os"
"testing"
)
func TestClarity(t *testing.T) {
imgData, err := os.Open("2.jpg")
if err != nil {
t.Error(err)
}
img, _, err := image.Decode(imgData)
if err != nil {
t.Error(err)
}
detector := NewConcurrentDetector(WithMeanThreshold(13.0), // 提高均值阈值
WithLaplaceStdThreshold(25.0), // 提高标准差阈值
WithMaxWorkers(8), // 设置并发数
)
check, err := detector.ClarityCheck(img)
if err != nil {
t.Error(err)
}
t.Log(check)
}