package hawaii.edu;

public class DoorDetector {

}

@@ -18,35 +18,1194 @@
 u;%0A%0A
-public class DoorDetector %7B%0A
+import java.awt.Color;%0Aimport java.awt.image.BufferedImage;%0Aimport java.io.File;%0Aimport java.io.IOException;%0A%0Aimport javax.imageio.ImageIO;%0A%0A/**%0A * Detects doors using edge detection, angle detection, and other methods%0A * related to the field of computer vision.%0A * %0A * @author Kendyll Doi%0A * %09%09%09Edward Meyer%0A * %09%09%09Keone Hiraide%0A */%0Apublic class DoorDetector %7B%0A%09/**%0A%09 * Image of a door.%0A%09 */%0A%09private BufferedImage img = null;%0A%09%0A%09/**%0A%09 * Reads in the name of an image file and converts it to a grayscale%0A%09 * image to be used for processing.%0A%09 * %0A%09 * @param filename The name of the image file.%0A%09 */%0A%09public DoorDetector(String filename) %7B%0A%09%09// Read in the image.%0A%09%09try %7B%0A%09%09%09this.img = ImageIO.read(new File(filename));%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09System.out.println(%22error opening %22 + filename);%0A%09%09%7D%0A%09%09%0A%09%09// Transform the image into a grayscale image.%0A%09%09for (int i=0; i %3C this.img.getWidth(); i++) %7B%0A%09%09%09for (int j=0; j %3C this.img.getHeight(); j++) %7B%0A%09%09%09%09int rgb = this.img.getRGB(i, j);%0A%09%09%09%09int r = (rgb %3E%3E 16) & 0xFF;%0A%09%09%09%09int g = (rgb %3E%3E 8) & 0xFF;%0A%09%09%09%09int b = (rgb & 0xFF);%0A%09%09%09%09int gray = (r + g + b) / 3;%0A%09%09%09%09this.img.setRGB(i, j, new Color(gray, gray, gray).getRGB());%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D
 %0A%7D%0A

Add code that reads in an image, and converts the image into a grayscale BufferedImage.