I'm playing with some image processing algorithm (HOG descriptor) and
I'm a bit lost. I am a newbie in image processing (especially in python).
I have computed the vertical and horizontal gradients of an image
(convolution with [-1, 0, 1] on the 0 and 1 axis respectively). After
that I computed the gradient' magnitude (sqrt(horizontal_gradient**2 +
vertical_gradient**2)) and orientation (arctan2(vertical_gradient,
Now I would like to display the original image with the gradient vector.
The quiver() function allows to plot vector fields and it's pretty easy
to convert the gradient' magnitude and orientation into U and V (U
=grad_mag*cos(grad_orientation), V = grad_mag*sin(grad_orientation)) but
I cannot figure out how to display the image and the gradient with the
Can anyone help?
Thanks in advance,
You can also use Numpy.gradient to compute the gradient , if e.g. your dx and dy aren't the same.
Royal Observatory of Belgium
> Date: Tue, 29 Jun 2010 16:28:11 +0200
> From: mathieu.dubois@...
> To: matplotlib-users@...
> Subject: Re: [Matplotlib-users] Displaying the gradient of an image
> I finally found the solution. It's as simple as:
> pylab.quiver(U, V, units='x');
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> Matplotlib-users mailing list
Get latest updates about Open Source Projects, Conferences and News.