mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-04 08:50:41 +08:00
[pre-commit.ci] pre-commit autoupdate (#9013)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.285 → v0.0.286](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.285...v0.0.286) - [github.com/tox-dev/pyproject-fmt: 0.13.1 → 1.1.0](https://github.com/tox-dev/pyproject-fmt/compare/0.13.1...1.1.0) * updating DIRECTORY.md * Fis ruff rules PIE808,PLR1714 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
![66853113+pre-commit-ci[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

parent
0a9438071e
commit
421ace81ed
@ -31,8 +31,8 @@ def get_slice(img: np.ndarray, x: int, y: int, kernel_size: int) -> np.ndarray:
|
||||
def get_gauss_kernel(kernel_size: int, spatial_variance: float) -> np.ndarray:
|
||||
# Creates a gaussian kernel of given dimension.
|
||||
arr = np.zeros((kernel_size, kernel_size))
|
||||
for i in range(0, kernel_size):
|
||||
for j in range(0, kernel_size):
|
||||
for i in range(kernel_size):
|
||||
for j in range(kernel_size):
|
||||
arr[i, j] = math.sqrt(
|
||||
abs(i - kernel_size // 2) ** 2 + abs(j - kernel_size // 2) ** 2
|
||||
)
|
||||
|
@ -11,8 +11,8 @@ def im2col(image, block_size):
|
||||
dst_width = rows - block_size[0] + 1
|
||||
image_array = zeros((dst_height * dst_width, block_size[1] * block_size[0]))
|
||||
row = 0
|
||||
for i in range(0, dst_height):
|
||||
for j in range(0, dst_width):
|
||||
for i in range(dst_height):
|
||||
for j in range(dst_width):
|
||||
window = ravel(image[i : i + block_size[0], j : j + block_size[1]])
|
||||
image_array[row, :] = window
|
||||
row += 1
|
||||
|
@ -71,8 +71,8 @@ if __name__ == "__main__":
|
||||
|
||||
# Iterating through the image and calculating the
|
||||
# local binary pattern value for each pixel.
|
||||
for i in range(0, image.shape[0]):
|
||||
for j in range(0, image.shape[1]):
|
||||
for i in range(image.shape[0]):
|
||||
for j in range(image.shape[1]):
|
||||
lbp_image[i][j] = local_binary_value(image, i, j)
|
||||
|
||||
cv2.imshow("local binary pattern", lbp_image)
|
||||
|
@ -118,8 +118,8 @@ def test_local_binary_pattern():
|
||||
|
||||
# Iterating through the image and calculating the local binary pattern value
|
||||
# for each pixel.
|
||||
for i in range(0, image.shape[0]):
|
||||
for j in range(0, image.shape[1]):
|
||||
for i in range(image.shape[0]):
|
||||
for j in range(image.shape[1]):
|
||||
lbp_image[i][j] = lbp.local_binary_value(image, i, j)
|
||||
|
||||
assert lbp_image.any()
|
||||
|
Reference in New Issue
Block a user