
import java.awt.Color;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.io.File;

import javax.imageio.ImageIO;

public class ImageSubtraction  extends OpenBB{
	
	CheckerboardImageGenerator hw;
	ImageResize hw1C;
	Image image6;
	int[][] image6Pixels,imagePixels, image2Pixels;
	
	public ImageSubtraction(){
		hw = new CheckerboardImageGenerator();
		hw1C = new ImageResize();
		image6Pixels = new int[400][400];
		imagePixels = new int[400][400];
		image2Pixels = new int[400][400];
		imagePixels = imageToMatrix((BufferedImage)hw.getImage());
		image2Pixels = imageToMatrix((BufferedImage)hw1C.getImage6());
		for(int i =0; i<400; i++){
			for(int j=0; j<400; j++){
				if(image2Pixels[i][j]-imagePixels[i][j]<0){
					image6Pixels[i][j] = 0;
				}else
					image6Pixels[i][j] = image2Pixels[i][j]-imagePixels[i][j];
			}
		}
		
		image6 = matrixToImage("Pl-out3", image6Pixels);
		
	}
	

public Image getImage6(){
	return image6;
}
	

}
