Gradient Field of an Image...

2 views (last 30 days)
Philip on 17 Feb 2011
Does anyone know how to calculate the gradient field of an image? I have checked the use of Quiver plots to achieve this, but am having difficulties applying it to an image...
Many thanks in advance for any help anyone can give!

Accepted Answer

Sean de Wolski
Sean de Wolski on 17 Feb 2011
You can calculate the gradient using:
doc gradient
and then use the results from that for your quiver plot.
  1 Comment
Philip on 21 Feb 2011
Thanks! I think this should be on the right lines, but I'm having a few issues using quiver... How can I overlay the gradient field for the entire image?
I am currently using:
[gx gy] = gradient(dens,.2,.2);
hold on;
title('Gradient Field');
And after some processing time, I just get back a completely blue figure... Do you happen to know what I am doing wrong?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by