Skip to content

Edge Detection Research

Ciaran-OBrien edited this page Oct 24, 2018 · 3 revisions

Four men in a tub

Sobel

# Performing each edge fitlering method on the image file  
# What each filter is trying to achieve is to calculate the derivitive of the image
# When you look at an image, edges are defined by a drastic change between two, or a set of pixels
# This change in the image should appear as a spike in graph when the dervitives are plotted

# The Sobel Operator is a discrete differentiation operator. 
# It computes an approximation of the gradient of an image intensity function.
# The Sobel Operator combines Gaussian smoothing and differentiation.

# The operator consists of a pair of 3X3 convolution kernels 

# | -1 | 0 | +1 |  | +1 | +2 | +1 |
# | -2 | 0 | +2 |  |  0 |  0 |  0 |
# | -1 | 0 | +1 |  | -1 | -2 | -1 |
#        GX                    GY
# The computation time for the sobel operator is longer compared to the rest of the filters
# Howevert, this is simply due to the larger kernel, but also allows for a cleaner image, which is less sensitive to noise
edge_sobel = sobel(carImage)

Sobel Filter

Scharr

# | +3  | 0 | -3  |   | +3 | +10 | +3 |
# | +10 | 0 | -10 |   | 0  |  0  |  0 |
# | +3  | 0 | -3  |   | -3 | -10 | -3 |
#        GX                   GY
edge_scharr = scharr(carImage)

Scharr Filter

Prewitt

# | -1 | 0 | +1 |  | +1 | +1 | +1 |
# | -1 | 0 | +1 |  |  0 |  0 |  0 |
# | -1 | 0 | +1 |  | -1 | -1 | -1 |
#       GX               GY
edge_prewitt = prewitt(carImage)

Prewitt Filter

Roberts

# |  0 | 1 |  | 1 |  0 |
# | -1 | 0 |  | 0 | -1 |
#      GX         GY
edge_roberts = roberts(carImage)

Roberts Filter

Clone this wiki locally