SumitBirla.com

Home » Software » Image Processing I » Smoothing and Edge Detection

Assignment 5: Smoothing and Edge Detection

This part of the report is related to gaussian smoothing and edge detection.

Source code:

  • GaussianSmooth - implements Gaussian smoothing. Contains the following methods:
    • GaussianSmooth();
    • int[] smoothen(int[], double sigma, int width, int height);
  • EdgeDetector - performs edge detection.
    • EdgeDetector(int[], int width, int height);
    • int[] getGradientImage();
    • int[] getEdges(int threshold);
    • int[] getEdges(int threshold, int angle);


Sample pictures:


Input image

Sigma = 1

Sigma = 2

Sigma = 3


Original -> Gausssian -> edge detected (Gradient threshold = 10)



Angle = 10

Angle = 100



Analysis:
The gradient amplitude shown as intensity on the gradient image relates to the change in pixel intensity (possibly an edge) at a particular point in the image. By thresholding this image with some value, one can show the edges clearly in the binary image. The use of gradient direction can be used for detecting edges at a particular angle. The images below show the results of such detection with angles of 10o, 45o and 135o. If we had chosen any other angle, we would not have detected anything because the original image does not contain any significant edge at any other angle.


Original

Angle = 10

Angle = 45

Angle = 135



Gradient direction would not help at all if we had a more complex image like the one below.




If the original image contains noise, every noise pixel shows up as an edge. This results in undesirable information in the edge-detected image. Gaussian smoothing helps reduce this problem. This works well with small sigma, however, when gaussian is increased, we start losing some of the actual edges as well (since the edges are not as discrete anymore). In practice, one should try different Gaussians ("scales" in the Marr-Hildreth approach) to get optimal edge detection.


Original image -> edge detected (Gradient threshold = 8)


Gaussian smoothed -> edge detected (Gradient threshold = 4)