问题
I am currently working on inhomogeniety removal from MRI data volume which contains voxels. I want to apply sobel operator on those volumes to find the gradient. I am familiar with 2d sobel mask and the neighbourhood of 2d images.
sobel mask: 1 2 1 0 0 0 -1 -2 -1 1 0 -1 2 0 -2 1 0 -1
neighbourhood of(x,y): (x+1,y-1) (x+1,y) (x+1,y+1) (x,y-1) (x,y) (x,y+1) (x-1,y-1) (x-1,y) (x-1,y+1)
Now I want to apply it on 3d. Please suggest me how should I proceed?? Thank you.
回答1:
Wikipedia has a nice introduction about that : http://en.wikipedia.org/wiki/Sobel_operator
Basically, since the sobel filter is separable, you can apply 1D filters in each of x, y and z directions consecutively. Theses filters are h(x) and h'(x) as given on wikipedia. Doing so will allow you to get the edges in the direction where you applied h'(x).
For example, if you do h(x)*h(y)*h'(z), you'll get the edges in the direction z.
Alternatively (and more expensively), you can compute the whole 3D 3x3x3 kernel and apply the convolution in 3D. The kernel for the z direction is given on wikipedia as well.
来源:https://stackoverflow.com/questions/7330746/implement-3d-sobel-operator