✨ add image clarity detection
This commit is contained in:
27
common/clarity/clarity_test.go
Normal file
27
common/clarity/clarity_test.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user