import java.applet.*; import java.awt.*; import java.awt.image.*; import java.net.*; import java.util.*; import java.io.*; import java.lang.Math; /** * Dilate is an algorithm to dilate a binary image using a 3x3 kernel. * @author Simon Horne * @author Craig Strachan * @author Judy Robertson, SELLIC Online */ public class Dilate extends Thread { /** * Default no-arg constructor. */ public Dilate() { } /** * Takes a point and a 2D array representing an image and a kernel, if the * area around the point matches the kernel then the method returns true. * * @param p The point in the centre of the neighbourhood to be checked. * @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 kernel used to match with the image. * @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