public static BufferedImage subtract(BufferedImage imb, BufferedImage imb2){
       int width=imb.getWidth();
       int height=imb2.getHeight();
       int k=0;
       int locationx=0;
       int locationy=0;
       int lastk=0;
       double kd=0.0;
       boolean criticalLoc=true;
       BufferedImage imbd=new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
       for(int i=1; i<width; i++){
           for(int j=1; j<height; j++){
               k=Math.abs(imb.getRGB(i, j))-(imb2.getRGB(i, j));
               imbd.setRGB(i, j, k);
           }
       }
       return imbd;
   }