diff --git a/src/vstarstack/tool/image_processing/drop_unsharp.py b/src/vstarstack/tool/image_processing/drop_unsharp.py index 8d3382a..c148fc4 100644 --- a/src/vstarstack/tool/image_processing/drop_unsharp.py +++ b/src/vstarstack/tool/image_processing/drop_unsharp.py @@ -31,23 +31,21 @@ class EstimationMethod(Enum): LAPLACE = 1 def measure_sharpness_sobel(img : np.ndarray, mask : np.ndarray | None) -> float: - if mask is not None: - img = img * mask sx = scipy.ndimage.sobel(img, axis=0, mode='constant') sy = scipy.ndimage.sobel(img, axis=1, mode='constant') sobel = np.sqrt(sx**2 + sy**2) if mask is not None: sobel = sobel * mask + img = img * mask metric = np.sum(sobel) summ = np.sum(img) return metric / summ def measure_sharpness_laplace(img : np.ndarray, mask : np.ndarray | None) -> float: - if mask is not None: - img = img * mask laplace = cv2.Laplacian(img, cv2.CV_64F).var() if mask is not None: laplace = laplace * mask + img = img * mask metric = np.sum(laplace) summ = np.sum(img) return metric / summ