How to calculate gradients with a gaussian kernel

Hello,

As told by the title, I want to calculate image gradients with a gaussian kernel. It would be convoluting the image with the kernel in general. However, I also want to get gx, gy and the magnitude with sqrt(gx.^2+gy.^2).

ok, so you want to do something. assuming you want to turn that desire into action, did you try to do it?

I tried it in Matlab getting simply a gaussian kernel of 3*3 for example. It is simply a symmetric matrix leading to the same response in both x and y direction. This is definitely a mistake so that I posted this to see if there is a function in OpenCV doing this.

there’s cv::filter2D… but you probably already know about that function.

for direction, you need to apply two filters, one for gradients in X and one for gradients in Y direction. commonly, sobel kernels are used for that.

Thanks, @crackwitz. I have got that. I found some codes in git using differential to replace derivative, that 's why I always get a symmetric matrix.