public static BufferedImage mergeEdgeImages (BufferedImage img1, BufferedImage img2, BufferedImage img3, BufferedImage img4) {
      int width = img1.getWidth();
      int height = img1.getHeight();
      BufferedImage edgeImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
      
      for(int x = 0; x < width; x++) {
         for(int y = 0; y < height; y++) {
            edgeImage.setRGB(x, y, WHITE);
         }
      }
      
      for(int x = 0; x < width; x++) {
         for(int y = 0; y < height; y++) {
            if((img1.getRGB(x, y) == BLACK) ||
               (img2.getRGB(x, y) == BLACK) ||
               (img3.getRGB(x, y) == BLACK) ||
               (img4.getRGB(x, y) == BLACK) 
            ) {
               edgeImage.setRGB(x, y, BLACK);
            }
         }
      }
      
      return edgeImage;
   }