COSC 387: Artificial Intelligence

Project 5
Spring 2001

Due: Dec 6 @ 5 P.M.
16 points

  1. Write a program that, when given a 128 x 128 binary image of either the plane, club, bull, or clover (pictured below), detects the plane.

  2. The four objects in a 128 x 128 gif image format are clover.gif, club.gif, bull.gif, and plane.gif.

  3. The four objects in a portable graymap (pgm) format are clover.pgm, club.pgm, bull.pgm, and plane.pgm. For our purposes, pgm is a more convenient image format than gif. Here are the first six lines of the file bull.pgm:
    P2
    # CREATOR: XV Version 3.10a  Rev: 12/29/94
    128 128
    255
    255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
    255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
    
    The first line (i.e., P2) is a magic number that identifies the pgm file type. Any line that starts with the # character is a comment, so in this image, the second line is a comment. The third line (i.e., 128 128) specifies the width and height of the image, respectively. The fourth line (i.e., 255) contains the maximum gray value. The remaining lines contain the pixel values. Don't worry about being able to read any pgm file, just worry about reading files for this project. The header will have four lines, there will be 128 x 128 black (0) and white (255) pixels. All of the images I will use to test your project will follow this format. Do not modify format of the image files. However, you may manipulate the objects in the images in any manner you see fit, subject, of course, to the laws of good taste, the United States, and People for the Ethical Treatment of Animals.

  4. The top-level function, detect-plane, should take a string as an argument, which is the name of the file containing the 128 x 128 image in pgm format. The function should load the image, do whatever processing is necessary to detect the plane, and evaluate to either T or NIL depending on whether the plane is present in the image. There will be only one object in each image. For example, consider the following two function calls as examples:
    > (detect-plane "bull.pgm")
    NIL
    > (detect-plane "plane.pgm")
    T
    
  5. In the header comments of your source file, describe in detail your implementation, the pre-processing steps, the features, the decision algorithm, etc. Also discuss the object transformations (i.e., translation, scale, and rotation) that your implementation is capable of handling. Feel free to use Lisp, C, C++, or Java, provided that your program compiles and executes under UNIX.

    If you use C or C++, then I should be able to type a.out plane.pgm or a.out bull.pgm and have the program report T or NIL to standard output.

    If you use Java, then name your top-level class proj5. I should be able to type java proj5 plane.pgm or java proj5 bull.pgm and have the program report T or NIL to standard output.

Instructions for Submission

In the header comments, provide the following information:
;;;;
;;;; Name
;;;; E-mail Address
;;;; Platform: Windows, Linux, Solaris (cssun)
;;;; Lisp Environment: gcl, clisp, cmucl
;;;; Mail Client: mailx, pine, GUMail, Netscape, Yahoo!, etc.
;;;;
;;;; In accordance with the class policies and Georgetown's Honor Code,
;;;; I certify that, with the exceptions of the lecture notes and those
;;;; items noted below, I have neither given nor received any assistance
;;;; on this project.
;;;;
When you are ready to submit your program for grading, e-mail it to me as one file with your net ID and the suffix ``.lisp'' as the subject line.

For example, if you were to submit using mailx on cssun, and if your net ID is ab123 and the name of your source file is proj1.lisp, then type at the UNIX prompt:

cssun% mailx -s "ab123.lisp" maloof@cs < proj1.lisp
If you use some other mail client, then follow the same instructions, and send your code as an attachment. Submit your project before 5:00 P.M. on the due date.

Once submitted, it is important to keep an electronic copy of your project on either cssun or gusun. If we lose your project or the e-mail system breaks, then we will need to look at the modification date and time of your project to ensure that you submitted it before it was due. If you developed your code on a Windows machine, then use a secure ftp client to transfer your file to cssun or gusun.

Finally, when storing source code on university machines, it is important to set file permissions so others cannot read the file. To turn off such read/write permissions, type at the UNIX prompt chmod og-rw <file>, where <file> is the name of your source file.