Worksheet #9
Image Processing and Edge Detection
                                             Name ______________


1. Copy the image file: /home/atlas1/ai/fig1.pgm.  
   Copy the Lisp starter file: /home/atlas1/ai/edgeDetect.lsp.
   
2. Perform the following edge detection routines:
   A. Horizontal differencing: 
        Image2[i,j] = Image[i+1,j+1] - Image[i,j]
        Set the pixels in the last column equal to 0

   B. Robert's cross with sqrt:
        Image2[i,j] = sqrt (sqr (image1[i,j] - image1[i+1, j+1]) +
                            sqr (image1[i,j+1] - image1[i+1, j]))
      Use (floor x) to truncate the result
      Also set the pixels in the last row and last column to 0.

   C. Robert's cross using absolute value:
        Image2[i,j] = (abs (image1[i,j] - image1[i+1, j+1])) +
                      (abs (image1[i,j+1] - image1[i+1, j]))        

   D. Variation of the cross pattern:
        Image2[i,j] = abs(image1[i,j-1] - image1[i, col+1]) +
                      abs(image1[i-1, j] - image1[i+1, j])
        Set the first and last rows and cols to 0.

   E. Sobel operator:
      For this pattern around pixel e:
         a  b  c
         d  e  f
         g  h  i

        dx = c + 2f + i - a - 2d - g
        dy = a + 2b + c - g - 2h - i
        
        Image[i,j] = sqrt (sqr(dx) + sqr(dy))
        Use (floor x) to truncate the sqrt.
        If the value is > 255, reset it to 255 so that 255 is the max value
        Set the first and last rows and cols to 0

3. Save each of the previous edge detected images under different file names.
   Compare the strength of each edge detection algorithm.