views:

58

answers:

1

I would like to plot gradient magnitudes of an color image in matlab. Precisely saying i want the gradient in my x-axis and the log of probability density on my y axis. i would request if someone can help me out. Thanks

+2  A: 

These are the steps you'll need to figure out (I'm not going to write code for you, because I haven't got Matlab at home, and because I'm lazy):

  1. Convert your image to grayscale.
  2. Determine a suitable finite-difference approximation to the gradient operator.
  3. Apply the finite-difference kernel using conv2.
  4. Take the abs of the result.
  5. Use hist to calculate a histogram.
  6. Plot the result, converting as appropriate with log, or semilogy.
Oli Charlesworth
thanks a lot.. i got it