feat: blur detection via Laplacian variance
This commit is contained in:
11
analyzer.py
Normal file
11
analyzer.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
|
||||
def is_blurry(path: str, threshold: float = 100.0) -> bool:
|
||||
"""Gibt True zurueck, wenn das Bild unscharf ist (Laplacian Variance < threshold)."""
|
||||
img = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
|
||||
if img is None:
|
||||
return False
|
||||
variance = cv2.Laplacian(img, cv2.CV_64F).var()
|
||||
return bool(variance < threshold)
|
||||
Reference in New Issue
Block a user