image gradient - a 2D vector field If I(x,y) is thought of as a function, then grad(I) = (I_x, I_y) = (dI/dx, dI/dy) where dI/dx and dI/dy are vector fields that give a local direction of change For a specified point, the gradient gives you a vector that points in the maximum increasing direction The gradient normally assumes the underlying function ( I(x,y) in this case ) is continuous. Since images are discrete though, we must approximate the gradient by setting I_x = [ I(x+1,y) - I(x-1,y) ] / 2 I_y = [ I(x,y+1) - I(x,y-1) ] / 2 The gradient magnitude is defined as ||grad(I)|| = sqr(I_x^2 + I_y^2) For notes on C++, please review the slides.