-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce the complexity of digital_image_processing/edge detection/canny.py #8167
Reduce the complexity of digital_image_processing/edge detection/canny.py #8167
Conversation
…cessing/edge_detection/canny.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change
…cessing/edge_detection/canny.py
@cclauss please review |
@@ -110,6 +115,24 @@ def canny(image, threshold_low=15, threshold_high=30, weak=128, strong=255): | |||
else: | |||
dst[row, col] = 0 | |||
|
|||
|
|||
def canny(image, threshold_low=15, threshold_high=30, weak=128, strong=255): | |||
image_row, image_col = image.shape[0], image.shape[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image_row, image_col = image.shape[0], image.shape[1] | |
image_row, image_col = image.shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
gradient_direction = np.rad2deg(sobel_theta) | ||
gradient_direction += PI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gradient_direction = np.rad2deg(sobel_theta) | |
gradient_direction += PI | |
gradient_direction = PI + np.rad2deg(sobel_theta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Are there tests? |
1ffa6e8
to
a806c0d
Compare
an edge pixel's value is smaller than the low threshold value, it will be | ||
suppressed. | ||
""" | ||
return dst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why daylight savings time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to destination
No, there weren't tests. I ran the script before and after changes - there is no differences in output images. |
…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>
…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>
Describe your change:
Reduce the complexity of digital_image_processing/edge detection/canny.py from 17 to 11
Checklist:
Fixes: #{$ISSUE_NO}
.