Canny edge improvement#14662
Conversation
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| import numpy as np | ||
|
|
||
|
|
||
| def grayscale(image: np.ndarray) -> np.ndarray: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function grayscale
| # np.uint8 = converts values to 8-bit integers(0-255) | ||
|
|
||
|
|
||
| def gaussian_kernel(kernel_size: int = 5, sigma: float = 1.4) -> np.ndarray: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function gaussian_kernel
| return kernel / kernel.sum() | ||
|
|
||
|
|
||
| def convolve(image: np.ndarray, kernel: np.ndarray) -> np.ndarray: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function convolve
| return output | ||
|
|
||
|
|
||
| def gaussian_blur( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function gaussian_blur
| return convolve(image, kernel) | ||
|
|
||
|
|
||
| def sobel_gradients(image: np.ndarray) -> tuple[np.ndarray, np.ndarray]: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function sobel_gradients
| return gradient_magnitude, gradient_direction | ||
|
|
||
|
|
||
| def non_maximum_suppression( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function non_maximum_suppression
| return suppressed | ||
|
|
||
|
|
||
| def double_threshold( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function double_threshold
| return result, weak, strong | ||
|
|
||
|
|
||
| def hysteresis( |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function hysteresis
| self.low_threshold_ratio = low_threshold_ratio | ||
| self.high_threshold_ratio = high_threshold_ratio | ||
|
|
||
| def detect(self, image_path: str) -> np.ndarray: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file computer_vision/cannyedge.py, please provide doctest for the function detect
|
I did not write doctests |
Describe your change:
Checklist: