add image clarity detection

This commit is contained in:
2025-03-05 17:43:59 +08:00
parent c0d0d784d6
commit d8d98eb31c
22 changed files with 850 additions and 64 deletions

View File

@@ -0,0 +1,27 @@
package clarity
import (
"bytes"
"image"
"os"
"testing"
)
func TestClarity(t *testing.T) {
//detector := NewDetector(
// WithConcurrency(8), WithBaseThreshold(90), WithEdgeBoost(1.2), WithSampleScale(1))
//imgData, _ := os.ReadFile("4.png")
//blurred, confidence, err := detector.Detect(imgData)
//if err != nil {
// t.Error(err)
//}
//t.Log(blurred, confidence)
imgData, _ := os.ReadFile("2.png")
img, _, err := image.Decode(bytes.NewReader(imgData))
clarity, err := Clarity(img)
if err != nil {
t.Error(err)
}
t.Log(clarity)
}