Reduce the complexity of digital_image_processing/edge detection/canny.py#8167
Merged
cclauss merged 13 commits intoTheAlgorithms:masterfrom Apr 1, 2023
Conversation
…cessing/edge_detection/canny.py
…cessing/edge_detection/canny.py
Member
Author
|
@cclauss please review |
cclauss
reviewed
Apr 1, 2023
|
|
||
|
|
||
| def canny(image, threshold_low=15, threshold_high=30, weak=128, strong=255): | ||
| image_row, image_col = image.shape[0], image.shape[1] |
Member
There was a problem hiding this comment.
Suggested change
| image_row, image_col = image.shape[0], image.shape[1] | |
| image_row, image_col = image.shape |
Member
There was a problem hiding this comment.
This function is not using image.shage so why bother unpacking it?
Make all the functions use image.shape instead of separate row and col.
cclauss
reviewed
Apr 1, 2023
Comment on lines
125
to
126
| gradient_direction = np.rad2deg(sobel_theta) | ||
| gradient_direction += PI |
Member
There was a problem hiding this comment.
Suggested change
| gradient_direction = np.rad2deg(sobel_theta) | |
| gradient_direction += PI | |
| gradient_direction = PI + np.rad2deg(sobel_theta) |
Member
|
Are there tests? |
1ffa6e8 to
a806c0d
Compare
cclauss
reviewed
Apr 1, 2023
| an edge pixel's value is smaller than the low threshold value, it will be | ||
| suppressed. | ||
| """ | ||
| return dst |
Member
Author
There was a problem hiding this comment.
Renamed to destination
Member
Author
No, there weren't tests. I ran the script before and after changes - there is no differences in output images. |
cclauss
approved these changes
Apr 1, 2023
tianyizheng02
pushed a commit
to tianyizheng02/Python
that referenced
this pull request
May 29, 2023
…y.py (TheAlgorithms#8167) * Reduce the complexity of digital_image_processing/edge_detection/canny.py * Fix * updating DIRECTORY.md * updating DIRECTORY.md * updating DIRECTORY.md * Fix review issues * Rename dst to destination --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change:
Reduce the complexity of digital_image_processing/edge detection/canny.py from 17 to 11
Checklist:
Fixes: #{$ISSUE_NO}.