Screenshots     Download     Purchase     Documentation     Tutorials     Resources     Contact     Forum     Search  

 

Sobel Edge

The Sobel Edge filter is use to detect edges based applying a horizontal and verticle filter in sequence. Both filters are applied to the image and summed to form the final result. The two filters are basic convolution filters of the form:

Interface

Horizontal FilterVerticle Filter
1 2 1
0 0 0
-1 -2 -1
-1 0 1
-2 0 2
-1 0 1

For example, if a 3x3 window is used as such

p1 p2 p3
p4 p5 p6
p7 p8 p9
where the filter is centered on p5 with p4 being pixel[x-1][y] and p6 being pixel[x+1][y], etc. then the formula to calculate the resulting new p5 pixel is

new_pixel_intensity = (p1+(p2+p2)+p3-p7-(p8+p8)-p9)+(p3+(p6+p6)+p9-p1-(p4+p4)-p7)

which is them clamped to the 0-255 range.

Note that the actual formula uses the horizontal and vertical components into the final form

new_pixel_intensity = SQRT((X*X)+(Y*Y))

where X = (p1+(p2+p2)+p3-p7-(p8+p8)-p9) and Y = (p3+(p6+p6)+p9-p1-(p4+p4)-p7)

but for performance reasons we approximate the result and leave the final SQRT formula out.

Note that the new pixel values need to be placed into a new image buffer so as not to corrupt the pixel values of the current image.

For color images the formula is applied to all three color channels separately.

Example

Source ImageSobel

See Also

Frei & Chen
Prewitt Filter
Convolution Filter



© 2010 RoboRealm. All Rights Reserved. | Contact | Glossary | Privacy | Disclaimer | Link to Us | Resources | Site Map