code: public void generateBackgroundEdgeFromForegroundEdge() {
          backgroundEdgePixels.clear();
          Point p, p2;
          Iterator<Point> it = foregroundEdgePixels.iterator();
          while( it.hasNext() ) {
              p = new Point(it.next());
              for( int j = -1; j < 2; ++j ) {
                  for( int i = -1; i < 2; ++i ) {
                      if ((p.x + i >= 0) && (p.x + i < width) && (p.y + j >= 0) && (p.y + j < height)) {
                          p2 = new Point(p.x + i, p.y + j);
                          if (pixels[p2.x][p2.y] == BACKGROUND) {
                              backgroundEdgePixels.add(p2);
                          }
                      }
                  }
              }
          }
      }
docs: Generates the background edge hash set from the foreground edge
  hash set and the 2D array of pixels.