hanna banana

hanna banana

  • NA
  • 3
  • 1.8k

finding the gradient from image pixels..

Dec 29 2011 1:12 PM
i have problem in calculating and finding gradients of pixels



 int gradient1 = (y1 - y5) / (x1 - x5);
 int gradient2 = (y2 - y5) / (x2 - x5);

from the image shown and the gradients calculations.. supposedly gradient1 = +ve value and gradient2 = -ve value..
but from the result i get both gradients are "0" i don't know where i have it wrong here.. if anyone could help me point out the mistake i've made.. thank you..


Answers (2)