File Exchange

image thumbnail

Gradient using first order derivative of Gaussian

version 1.0.0.0 (1.63 KB) by Guanglei Xiong
Output the gradient image of a grayscale image

9 Downloads

Updated 31 Mar 2016

View License

[gx,gy]=gaussgradient(IM,sigma) outputs the gradient image gx and gy of
image IM using a 2-D Gaussian kernel. Sigma is the standard deviation of
this kernel along both directions.

Comments and Ratings (17)

miao miao

Nice,thanks!

Atif Anwer

Yad prab

Hey, nice job man! I can easily visulaize the variations in my image.
But what if i m in 3D. With image in 2D and a time factor that is adds to the third dimenstion ?

Ernesto

thanks, it show clearly gx and gy

Can you add the paper/text you had referred to calculate the kernels in your code. Thanks!

Real nice work!!!

Seems like you are calculating too small kernel sizes when higher values of sigma are used, e.g., when sigma>10 the kernels are clearly truncated. With sigma>40 your kernel size becomes imaginary.

samur piere

can you mention the mathematical basis for kernel size and normalization steps. thx.

epsilon = 1e-2;
halfsize = ceil( sigma * sqrt(-2*log(sqrt(2*pi)*sigma*epsilon)) );

hx = hx/sqrt(sum(sum( abs(hx).*abs(hx) )));

hbu 

hbu  (view profile)

good

Andrea Tagliasacchi

Works perfectly it seems, Thanks

masha yusrina

there was a problem using the function imshow(fim(1:50,1:50),'InitialMagnification','fit'); in 'fit'

i can't solve it

renuka patnaik

there was a problem using the function imshow(fim(1:50,1:50),'InitialMagnification','fit'); in 'fit'

Michal Kujalowicz

Theare is a problem with fim=mat2gray(im); instruction,in "testgaussgradient.m" (matlab R14)I got "matrix im should be a double error".
It can be solved by adding im=double(im);
after reading image (3 line)

H N

Image processing toolbox is not required if you use conv2 instead of imfilt.

Updates

1.0.0.0

BSD

1.0.0.0

change Summary

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: 3D blob segmentation

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video