import java.applet.*; import java.awt.*; import java.awt.image.*; import java.net.*; import java.util.*; import java.io.*; import java.lang.Math; /** * Erode is an algorithm to erode a binary image using a 3x3 kernel. * * @author Simon Horne * @author Craig Strachan * @author Judy Robertson, SELLIC Online */ public class Erode extends Thread { /** * Default no-args constructor. */ public Erode() { } /** * Returns true if the kernel matches the area of image centred on * the given point. * * @param p The centre point identifying the pixel neighbourhood. * @param pixels The 2D array representing the image. * @param w The width of the image. * @param h The height of the image. * @param kernel The array representing the kernel. * @return True or false (true - the kernel and image match). */ public static boolean kernelMatch(Point p, int [][] pixels, int w, int h, int [] kernel){ for(int j=-1;j<2;++j){ for(int i=-1;i<2;++i){ if (kernel[((j+1)*3)+(i+1)]==1) { if((p.x+i>=0)&&(p.x+i=0)&&(p.y+j