-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[WIP] Add 3D support to sobel #2787
base: main
Are you sure you want to change the base?
Conversation
Added generalized version of Sobel edge detection in a particular direction. Accepts N-dimensional images, using h=[1, 2, 1] and h'=[1, 0, -1]. Only tested for 3D images. however.
Hello @dcz-mpipz! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on September 01, 2017 at 12:56 Hours UTC |
h = np.array([1, 2, 1]) | ||
for i in range(ndim - 1): | ||
ret = np.multiply.outer(ret, h) | ||
factor = ret.sum(1).max() # Find maximum factor for normalization |
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.
I'm not sure this is the right normalization but on the other hand the normalization of the 2D kernel seems weird (it does not correspond to the definition of the Wikipedia web page for Sobel)
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 was just a guess, based on what other kernels in edges.py
look like. It's more of a placeholder.
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.
From git blame I think it was @ahojnnes who wrote the kernels with the normalization.
I think you would need to modify also the |
You're right, I'll try to get around to it soon. Should that be a separate pull request? |
No, it should be done in the same branch, and as you push new commits they will automatically appear in this pull request. |
Added generalized version of Sobel edge detection in a particular direction. Accepts N-dimensional images, using h=[1, 2, 1] and h'=[1, 0, -1]. Only tested for 3D images. however.
Description
This change provides a way to implement a full Sobel operator, as noted in #2247
The sobel implementation is directional, and provides a function generating kernels. The values of sobel function can be greater than 1, despite normalizing the matrix. Dimensions above 3 were not checked, since I don't know what to expect and how to write tests.
Adding a full Sobel shouldn't be difficult, e.g. by analogy to 2-dim Sobel:
I did not implement that, since I don't know whether sqrt(2) is a suitable factor for higher dimensions.
Checklist
For reviewers
(Don't remove the checklist below.)
later.
__init__.py
.doc/release/release_dev.rst
.