July 18, 2015

Edge Detection

detection helps in the detection of major features of an image edges,lines,etc.

Mainly the edges in an image are detected in 2 ways:

  1. Points representing the local maxima or local minima of the first derivative
  2. Points representing the zero crossing of the second derivative.

Some of the edge filters available in OpenCV are:

1.Laplace Filter:

Laplace Operator is represented as:
aplace operator

The mask representing the Laplacian Operator can easily be derived by adding the double derivatives in both x and y directions as obtained from the Finite Difference Method. Taylor series approximation is done in order to find the double derivatives

0  1 1
1 -4 1
0 1 0


The Laplacian Operator can detect edges in any direction.

import cv2 as cv
img= cv.LoadImage(‘pu-balls-452.jpg’)
cv.NamedWindow(‘laplacian kernel 3’,cv.CV_WINDOW_NORMAL)
cv.ShowImage(‘laplacian kernel 3’,lap)
cv.NamedWindow(‘laplacian kernel 5’,cv.CV_WINDOW_NORMAL)
cv.ShowIMage(‘laplacian kernel 5’,lap)

True Image

True Image

Laplacian Kernel 5

Laplacian Kernel 5

 Laplacian kernel3.

Laplacian kernel3.

Leave a Reply

Your email address will not be published. Required fields are marked *