Skielex / structure-tensor

Structure tensor 2D and 3D implementation for Python.
MIT License
47 stars 14 forks source link

Question on computing image gradients (Ix and Iy) #6

Closed ckolluru closed 2 years ago

ckolluru commented 2 years ago

Hi,

I have a question about the way Ix and Iy are computed (lines 34 and 35 in st2d.py)

Ix = ndimage.gaussian_filter(image, sigma, order=[1, 0], mode='nearest')
Iy = ndimage.gaussian_filter(image, sigma, order=[0, 1], mode='nearest')

The way I understand it is that we would like to get a "smooth" gradient image. This can be done by first convolving with a gaussian filter on the image to reduce the noise, and then computing the gradients. However, to make this process more efficient, the same result can be obtained by convolving the image with the first derivative of a gaussian.

In these lines, it seems like the image is convolved with the gaussian filter and the output is considered to be the image gradient. Am I missing something here? Please let me know.

Thanks, Chaitanya

ckolluru commented 2 years ago

Never mind, just realized the order argument results in convolution with the derivative of the gaussian.