Wavelet Edge Detector in C#

Share on Facebook
Share on LinkedIn
Bookmark this on Google Bookmarks
Bookmark this on Yahoo Bookmark
Bookmark this on Digg
Bookmark this on Livedoor Clip
Share on FriendFeed

Introduction

Image edge detection refers to methods of identifying points in a digital image where brightness changes sharply. Mathematically speaking we are looking for points of discontinuity of the intensity function of the input image. The purpose of detecting edges in images is to capture changes in real world object properties such as discontinuities in depth, surface orientation, changes in material properties and variations in scene illumination, etc. Image edge detection plays an important role in image processing applications such as computer vision systems. For example these techniques can be used in surveillance systems to automatically identify objects of suspicious nature.

Real Challenge

In the ideal case, edges obtained by applying an edge detector to an image are a set of connected curves that describe the boundaries of objects. Unfortunately it is not always possible to obtain such ideal edges from real life images of moderate complexity. Edges obtained from natural images are normally affected by several effects such as blur, shading, inter reflections in the vicinity of object edges, etc. Stating a specific threshold on how large the intensity change between two neighboring pixels must be -in order for us to classify that as an edge- is not an easy problem. This is one of the reasons why image edge detection is not a trivial problem except in the case where objects in the scene are simple and the illumination conditions are well controlled.

Image Edge Detection Techniques

Many image edge detection techniques exist however most of them fall into one of two groups, search based and zero crossing based methods. The search based technique computes a measure of edge strength using a first order derivative expression such as the gradient magnitude then it searches for local directional maxima of the gradient. The zero crossing based technique searches for zero crossings in a second order derivative expression computed from the image. Such expression is usually a Laplacian or a non linear differential expression. A preprocessing smoothing stage typically Gaussian smoothing is almost always applied in order to reduce input image noise.

Wavelet Based Technique

Wavelet analysis can be used to analyze any signal including images by sorting data in terms of frequency. In its simplest forms, wavelet analysis is nothing but averaging and differencing of adjacent horizontal and vertical elements. From a signal analysis perspective, averaging is like applying a low pass filter while the differencing is a high pass filter. This implies that details and noise of the image are included in the high frequency bands which means the image data can be smoothed by such filtering. With that in mind we can exploit this behavior to identify those areas in the image where intensity changes sharply thus detecting edges.

Software Requirements Specification

Wavelet Edge Detector is intended to support the following features

  1. Process multiple input images
  2. Tapped page image viewer
  3. Synchronized image and edge views
  4. Zoom and stretch view
  5. Wavelet transform visualization
  6. Edge detection view
  7. Simple noise reduction using thresholds
  8. Progress view

We are going to implement that in C# programming language for the Windows operating system.

Program Logic

Wavelet Edge Detector performs the intended tasks mentioned previously as follows

  1. Initialization
  2. Read input image intensity values into memory
  3. Haar transform rows
  4. Haar transform columns
  5. Rescale detail bands for visualization
  6. Filter out the LL frequency band
  7. Apply the threshold
  8. Inverse Haar transform columns
  9. Inverse Haar transform rows
  10. Display reconstructed image

We are not going to include the implementation details here however the full source code is attached to the post.

Graphical User Interface

The main GUI of our program consists of a main menu bar, main toolbar, image and edge viewer, threshold dialog and status bar. Here is a snapshot that illustrates that.

Sample Output

Wavelet Edge Detector was tested using images of various noise levels. Edges in low level noise images are easy to recognize but for those images with high noise levels is harder to recognize, however one can set a threshold level to refine image edge detection. The following snapshot illustrates image edge detection functionality

The following snapshot illustrates wavelet transform output

Future Work

Wavelet Edge Detector was simple enough to demonstrate the concept of edge detection. It needs allot more work to improve but here is two areas where we can add to it.

  1. Support more wavelet types
  2. Support multi scale noise reduction

Source Code

The full source code can be downloaded by clicking the link below

Source Code

Search Terms...

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>