Plot gradient magnitudes of a colour image in matlab
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 densit开发者_C百科y on my y axis. i would request if someone can help me out. Thanks
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):
- Convert your image to grayscale.
- Determine a suitable finite-difference approximation to the gradient operator.
- Apply the finite-difference kernel using
conv2
. - Take the
abs
of the result. - Use
hist
to calculate a histogram. - Plot the result, converting as appropriate with
log
, orsemilogy
.
精彩评论