mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 18:49:26 +08:00
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038) * refactor: Fix naming conventions (#7038) * Update arithmetic_analysis/lu_decomposition.py Co-authored-by: Christian Clauss <cclauss@me.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038) * chore: Fix naming conventions in doctests (#7038) * fix: Temporarily disable project euler problem 104 (#7069) * chore: Fix naming conventions in doctests (#7038) Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -43,33 +43,33 @@ def canny(image, threshold_low=15, threshold_high=30, weak=128, strong=255):
|
||||
or 15 * PI / 8 <= direction <= 2 * PI
|
||||
or 7 * PI / 8 <= direction <= 9 * PI / 8
|
||||
):
|
||||
W = sobel_grad[row, col - 1]
|
||||
E = sobel_grad[row, col + 1]
|
||||
if sobel_grad[row, col] >= W and sobel_grad[row, col] >= E:
|
||||
w = sobel_grad[row, col - 1]
|
||||
e = sobel_grad[row, col + 1]
|
||||
if sobel_grad[row, col] >= w and sobel_grad[row, col] >= e:
|
||||
dst[row, col] = sobel_grad[row, col]
|
||||
|
||||
elif (PI / 8 <= direction < 3 * PI / 8) or (
|
||||
9 * PI / 8 <= direction < 11 * PI / 8
|
||||
):
|
||||
SW = sobel_grad[row + 1, col - 1]
|
||||
NE = sobel_grad[row - 1, col + 1]
|
||||
if sobel_grad[row, col] >= SW and sobel_grad[row, col] >= NE:
|
||||
sw = sobel_grad[row + 1, col - 1]
|
||||
ne = sobel_grad[row - 1, col + 1]
|
||||
if sobel_grad[row, col] >= sw and sobel_grad[row, col] >= ne:
|
||||
dst[row, col] = sobel_grad[row, col]
|
||||
|
||||
elif (3 * PI / 8 <= direction < 5 * PI / 8) or (
|
||||
11 * PI / 8 <= direction < 13 * PI / 8
|
||||
):
|
||||
N = sobel_grad[row - 1, col]
|
||||
S = sobel_grad[row + 1, col]
|
||||
if sobel_grad[row, col] >= N and sobel_grad[row, col] >= S:
|
||||
n = sobel_grad[row - 1, col]
|
||||
s = sobel_grad[row + 1, col]
|
||||
if sobel_grad[row, col] >= n and sobel_grad[row, col] >= s:
|
||||
dst[row, col] = sobel_grad[row, col]
|
||||
|
||||
elif (5 * PI / 8 <= direction < 7 * PI / 8) or (
|
||||
13 * PI / 8 <= direction < 15 * PI / 8
|
||||
):
|
||||
NW = sobel_grad[row - 1, col - 1]
|
||||
SE = sobel_grad[row + 1, col + 1]
|
||||
if sobel_grad[row, col] >= NW and sobel_grad[row, col] >= SE:
|
||||
nw = sobel_grad[row - 1, col - 1]
|
||||
se = sobel_grad[row + 1, col + 1]
|
||||
if sobel_grad[row, col] >= nw and sobel_grad[row, col] >= se:
|
||||
dst[row, col] = sobel_grad[row, col]
|
||||
|
||||
"""
|
||||
|
Reference in New Issue
Block a user