Edge Finding Routine Example Joe Weber for CNS 286-III The sample program edgefind.c gives an example of how to find oriented edges in an image. This subroutine searches for lines that are within 45 degrees of vertical. You could imagine a complementary routine that finds lines about the vertical. The user supplies the upper left corner (x0,y0), expected orientation (angle), and dimensions (width, height) of a window within which to search for the edge. An oriented edge filter is convolved with this search window. (See figure) (x0,y0) - width - +---------------------------------------+ | . a / / | angle 'a' measured h | . / / | from the vertical e | . / / | i | . / / | Mask moves along horizontal, g |... x .... / / ---> | x goes from 0 to width h | / / | t | / / | | / / | | / / | +---------------------------------------+ The output of the convolution is saved for each position (x) along the width of the window. This output is returned in a vector which is the length of the width of the search window. The output vector will have an extrema at the location of the oriented edge. (note that extrema could be a maximum or a minimum depending on whether the edge goes from dark to light or light to dark). This demo program searches within a small window for an edge oriented at 20 degrees. After finding the location of the edge, it then tries different orientations to find the best match. It then draws a green line on the image to show the best match it found. What to do: compile program via: gcc edgefind.c -lm run it: a.out look at result using display program: display outimage.miff You will need the source code 'edgefind.c' and the image 'corner1.miff' which can be found in ~weber/Images/ The images are in MIFF format. The program 'display' displays MIFF images in an X window. (The program 'convert' will convert MIFF to any other format). Both programs can be found in ~weber/ImageMagick/ on the Suns of the Med cluster in 07 Moore.