2
Reply

finding the gradient from image pixels..

hanna banana

hanna banana

Dec 29 2011 1:12 PM
1.5k
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)