Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/vstarstack/tool/image_processing/drop_unsharp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np
import scipy.ndimage
from enum import Enum
import cv2

import vstarstack.library.data
import vstarstack.tool.cfg
Expand Down Expand Up @@ -44,9 +45,7 @@ def measure_sharpness_sobel(img : np.ndarray, mask : np.ndarray | None) -> float
def measure_sharpness_laplace(img : np.ndarray, mask : np.ndarray | None) -> float:
if mask is not None:
img = img * mask
sx = scipy.ndimage.laplace(img, mode='constant')
sy = scipy.ndimage.laplace(img, mode='constant')
laplace = np.sqrt(sx**2 + sy**2)
laplace = cv2.Laplacian(img, cv2.CV_64F).var()
if mask is not None:
laplace = laplace * mask
metric = np.sum(laplace)
Expand All @@ -64,9 +63,6 @@ def measure_sharpness_df(df : vstarstack.library.data.DataFrame, method : Estima
img, opts = df.get_channel(channel)
if not df.get_channel_option(channel, "brightness"):
continue
amax = np.amax(img)
amin = np.amin(img)
img = (img - amin)/(amax - amin)
mask, _, _ = df.get_linked_channel(channel, "mask")
if method == EstimationMethod.SOBEL:
metric += measure_sharpness_sobel(img, mask)
Expand Down