mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Delete empty junk file (#9062)
* updating DIRECTORY.md * updating DIRECTORY.md * Delete empty junk file * updating DIRECTORY.md * Fix ruff errors * Fix more ruff errors --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -100,7 +100,9 @@ def binarize(image: np.ndarray, threshold: float = 127.0) -> np.ndarray:
|
||||
return np.where(image > threshold, 1, 0)
|
||||
|
||||
|
||||
def transform(image: np.ndarray, kind: str, kernel: np.ndarray = None) -> np.ndarray:
|
||||
def transform(
|
||||
image: np.ndarray, kind: str, kernel: np.ndarray | None = None
|
||||
) -> np.ndarray:
|
||||
"""
|
||||
Simple image transformation using one of two available filter functions:
|
||||
Erosion and Dilation.
|
||||
@ -154,7 +156,7 @@ def transform(image: np.ndarray, kind: str, kernel: np.ndarray = None) -> np.nda
|
||||
return transformed
|
||||
|
||||
|
||||
def opening_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray:
|
||||
def opening_filter(image: np.ndarray, kernel: np.ndarray | None = None) -> np.ndarray:
|
||||
"""
|
||||
Opening filter, defined as the sequence of
|
||||
erosion and then a dilation filter on the same image.
|
||||
@ -172,7 +174,7 @@ def opening_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray:
|
||||
return transform(transform(image, "dilation", kernel), "erosion", kernel)
|
||||
|
||||
|
||||
def closing_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray:
|
||||
def closing_filter(image: np.ndarray, kernel: np.ndarray | None = None) -> np.ndarray:
|
||||
"""
|
||||
Opening filter, defined as the sequence of
|
||||
dilation and then erosion filter on the same image.
|
||||
|
Reference in New Issue
Block a user