Image gradient

In graphics programs for digital image editing such as Photoshop (a bitmap graphics editor) and Adobe Illustrator (a vector graphics editor), the term gradient is used for a gradual blend of colour which can be considered as an even gradation from low to high values, as used from white to black in the images to the right. If one views an image as a function, with darker pixels corresponding to higher function values, then the arrows showing the directions along which the image grows from white to dark are just the vector gradient of that function at the points in the image.

Mathematically, the gradient of a two-variable function (here the image intensity function) is at each image point a 2D vector with the components given by the derivatives in the horizontal and vertical directions. At each image point, the gradient vector points in the direction of largest possible intensity increase, and the length of the gradient vector corresponds to the rate of change in that direction.

Since the intensity function of a digital image is only known at discrete points, derivatives of this function cannot be defined unless we assume that there is an underlying continuous intensity function which has been sampled at the image points. With some additional assumptions, the derivative of the continuous intensity function can be computed as a function on the sampled intensity function, i.e. the digital image. It turns out that the derivatives at any particular point are functions of the intensity values at virtually all image points. However, approximations of these derivative functions can be defined at lesser or larger degrees of accuracy.

The Sobel operator represents a rather inaccurate approximation of the image gradient, but is still of sufficient quality to be of practical use in many applications. More precisely, it uses intensity values only in a 3&times;3 region around each image point to approximate the corresponding image gradient, and it uses only integer values for the coefficients which weight the image intensities to produce the gradient approximation.

The gradient of the image is one of the fundamental building blocks in image processing. For example the Sobel filter uses image gradient for edge detection.