In Computer Vision, Edge detection in images are very important for machine to understand its environment. So that it detects and classifies the objects around it. For a machine everything it sees through the camera are all numbers. The numbers will represent the intensity of light reflected from the object.


Let us analyze the pixel information in the above image. A point is chosen in the left image to see the pixel information, and the right side image shows  intensity values at that point.

Our aim is to find edges in the image, A human brain is embedded with all required algorithms to find edges, but a computer require them written by us.

What are the edges and how can we find them ?

Edges :

  • The points at which image brightness changes sharply are typically organized into a set of curved line segments termed edges.
  • Edges are significant local changes of intensity in an image
  • Edges typically occur on the boundary between two different regions in an image

Edge detection :

  • Edge detection is the name for a set of mathematical methods which aim at identifying points in a digital image at which the image brightness changes sharply or, more formally, has discontinuities.

The four steps of edge detection :

(1) Smoothing: suppress as much noise as possible, without destroying the true edges.

(2) Enhancement: apply a filter to enhance the quality of the edges in the image (sharpening).

(3) Detection: determine which edge pixels should be discarded as noise and which should be retained (usually, thresholding provides the criterion used for detection).

(4) Localization: determine the exact location of an edge (sub-pixel resolution might be required for some applications, that is, estimate the location of an edge to better than the spacing between pixels). Edge thinning and linking are usually required in this step.

Edge detection using derivatives

  • Calculus describes changes of continuous functions using derivatives.
  • An image is a 2D function, so operators describing edges are expressed using partial derivatives.

Points which lie on an edge can be detected by :

(1) detecting local maxima or minima of the first derivative

(2) detecting the zero-crossing of the second derivative


Edge models :

  1. Step
  2. Roof
  3. Ramp
  4. Spike

Derivative Masks :

  1. Backward difference [-1 1]
  2. Forward difference    [1 -1]
  3. Central difference     [-1 0 1]

Derivatives in 2-Dimension :

Let given function is f(x,y)

Gradient vector : D[f(x,y)] = [fx , fy]^T

Gradient magnitude : |D[f(x,y)]| = sqrt(fx^2 + fy^2)

Gradient direction :  theta = atan(fx/fy)










One thought on “Mathematics of EDGE Detection in Computer Vision

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s