EECS 207A. LAB 4 assignment

Fall 2004. UCI

By Nasser Abbasi

 

 

Introduction.. 1

Conclusion and resulting images. 1

Detailed image output. 1

Marr or Zero crossing, or the Laplacian of Gaussian (LOG) algorithm.. 2

Canny algorithm result 2

Algorithms overview... 2

Marr algorithm... 2

Canny algorithm... 2

Steps performed. 3

 

 

Introduction

The goal of this lab is to apply the marr edge detection algorithm (also called zero crossing, or the Laplacian of Gaussian edge detector) on 2 different types of images (one with more details, and another with more noise) and observe and comment on the results.

Next, Apply the canny algorithm on same images and comments on the differences between the two algorithms.

 

Conclusion and resulting images

 

I observed the following:

  1. Using the Marr algorithm, the edge lines themselves are thicker or wider (i.e. contain more pixels) than with Canny.
  2. All edges detected in the Marr algorithm are closed contours (loops). In the Canny algorithm this is not the case. Many edges are lines that terminated and did not close back in a loop.
  3. The Marr algorithm with STD=2 detects more edges than the Canny algorithm (used the Canny algorithm with its default setting).
  4. In the Marr algorithm, increasing the standard deviation, results in a larger gaussian filter window, and less edges detected. This is as expected, as a large averaging window size results in more smoothing, and hence more details will be lost. The Gaussian filter is a low pass filter.
  5. Overall, I found the Marr algorithm to be the better algorithm as far as the ability to detect more edges, but because the edges in the canny algorithm are thinner, the canny output as far as seeing the edges that were actually shown was better to see. Thinner edges look better than thicker edges.

 

 

Detailed image output.

To view or download the images, click on the image name.

 

Marr or Zero crossing, or the Laplacian of Gaussian (LOG) algorithm 

 

In addition to using standard deviation of 2, I also used standard deviation of 3 to see what the difference will be. With STD=3, we see that less of the smaller edges are detected as compared to when using STD=2. The Gaussian filter window is larger when the STD is larger; hence this explains why smaller boundaries are not detected in the later case. This can be seen best when putting all the images next to each other. 

 

This can be seen in this visio drawing generated image.

 

Image type

Original Image

Resulting image at standard deviation 2

Resulting image at standard deviation 3

More details

original

MARR_STD_2   (filter windows used 9x9 and 19x19)

STD_3  filter windows used 15x15 and 29x29)

More noise

original

MARR_STD_2  filter windows used 9x9 and 19x19)

MARR_STD_3  filter windows used 15x15 and 29x29)

 

Canny algorithm result

The algorithm was run using default values. To better see the performance of the canny edge detector, both original and resulting image are put next to each other. T

 

his is shown here

 

This table contains the original (same originals used with the MARR algorithm) and the resulting image files.

 

Image type

Original Image

Resulting image at standard deviation 2

More details

original

CANNY   (Gaussian smoothing window of width 7)

More noise

original

CANNY  (Gaussian smoothing window of width 7)

 

 

Algorithms overview

Marr algorithm

  1. Apply a linear averaging filter to the image (a Gaussian) of some window width (i.e. convolve the image with a Gaussian). We do this step to remove the noise in the image so that we can detect more the objects of interest themselves.
  2. Apply the Laplacian filter on the output of the above step. The result is called the Laplacian image.
  3. Scan the laplacian image looking for places where the laplacian crosses a zero. (i.e. The second derivate of the original image is zero). This will indicate the position of an edge.
  4. This is called the edge detection step. The result is the image with edges detected. Zero crossing always lie on closed paths.

Canny algorithm

Canny algorithms is based on these criteria:

  1. All edges must be detected. No false edge to be detected.
  2. Number of pixels between actual edge and the edge pixel must be small. (Localized edges). This explains why edges are thin in the output images.
  3. The same edge should not be detected twice (at different distances).

 

 

Steps performed

 

  1. Download images to use for the lab experiment.
  2. Download and install IRFANVIEW from http://www.irfanview.com/  This application will allow me to convert the images to type PGM, which is the required type needed for the edge detection applications.
    When converting images from JPG or GIF to PGM using IRFANVIEW, I used the default setting as shown here
  3. Copy the contents of chapter 1 in the CD that accompany the textbook to a folder on the PC.
  4. Compile Canny.exe and Marr.exe using VC++ 6.0 on windows
  5. Run marr.exe and canny.exe and generate the images. The following shows the actual steps to do this.

 

Trying to run the canny.exe program from the CD in the book resulted in this error

 

Stack Fault at eip=21fe

eax=00000301 ebx=000063b4 ecx=00000000 edx=0000ffff esi=00000634 edi=0000af51

ebp=0000ff9e esp=000518a8 cs=19f ds=17f es=17f fs=0 gs=0 ss=1b7 cr2=00001fd8

Call frame traceback EIPs:

  0x000021fe

  0xffb00001

 

The above happened on my home PC as well, which is XP professional. I have tried all windows OS’s by changing the compatibility mode on the .exe file, (using the properties dialog) and I kept getting the same error. Building the files from source resolved the problem.

 

 

The command for running Marr on the freeway image (detailed type image):

 

$ ./marr.exe freeway.pgm 2

Standard deviation= 2.000000

 

PBM file class 5 size 650 columns X 435 rows Max=255

Smoothing with a Gaussian of size 9x9

Convolution with LoG:

Zero crossings:

Smoothing with a Gaussian of size 19x19

Convolution with LoG:

Zero crossings:

Done. File is 'marr.pgm'.

 

 

The command for running Marr on the riverpost image (noisy type image):

 

$ ./marr.exe rivergaugepost.pgm 2

Standard deviation= 2.000000

 

PBM file class 5 size 693 columns X 900 rows Max=255

Smoothing with a Gaussian of size 9x9

Convolution with LoG:

Zero crossings:

Smoothing with a Gaussian of size 19x19

Convolution with LoG:

Zero crossings:

Done. File is 'marr.pgm'.

 

Using standard deviation of 3

$ ./marr.exe rivergaugepost_original.pgm 3 Standard deviation= 3.000000

 

 

 

PBM file class 5 size 693 columns X 900 rows Max=255

Smoothing with a Gaussian of size 15x15

Convolution with LoG:

Zero crossings:

Smoothing with a Gaussian of size 27x27

Convolution with LoG:

Zero crossings:

Done. File is 'marr.pgm'.

 

 

 

$ ./canny.exe freeway_original.pgm

CANNY: Apply the Canny edge detector to an image.

Parameter file 'canny.par' does not exist.

 

PBM file class 5 size 650 columns X 435 rows Max=255

Smoothing with a Gaussian (width = 7) ...

Convolution with the derivative of a Gaussian...

Beginning hysteresis thresholding...

Hysteresis thresholds (from image): HI 255 LOW D

Output file is:

  canny.pgm - edge-only image

 

 

$ ./canny.exe rivergaugepost.pgm

CANNY: Apply the Canny edge detector to an image.

Parameter file 'canny.par' does not exist.

 

PBM file class 5 size 693 columns X 900 rows Max=255

Smoothing with a Gaussian (width = 7) ...

Convolution with the derivative of a Gaussian...

Beginning hysteresis thresholding...

Hysteresis thresholds (from image): HI 255 LOW D

Output file is:

  canny.pgm - edge-only image