Return to Snippet

Revision: 1722
at November 10, 2006 00:10 by whitetiger


Updated Code
public BufferedImage Embrossing(BufferedImage bi)
	{
		BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
		
		Kernel kernel = new Kernel(3, 3, new float[] {
														-2f, 0f, 0f, 
														 0f, 1f, 0f, 
														 0f, 0f, 2f
													 });
		
		ConvolveOp op = new ConvolveOp(kernel);
		op.filter(bi, buff);
		
		return buff;
	}


	public BufferedImage Blurring(BufferedImage bi)
	{
		BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
		
		Kernel kernel = new Kernel(3, 3, new float[] {
														1f/9f, 1f/9f, 1f/9f, 
														1f/9f, 1f/9f, 1f/9f, 
														1f/9f, 1f/9f, 1f/9f
													 });
		
		ConvolveOp op = new ConvolveOp(kernel);
		op.filter(bi, buff);
		
		return buff;
	}


	public BufferedImage Sharpening(BufferedImage bi)
	{
		BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
		
		Kernel kernel = new Kernel(3, 3, new float[] {
														-1f, -1f, -1f, 
														-1f,  9f, -1f, 
														-1f, -1f, -1f
													 });
		
		ConvolveOp op = new ConvolveOp(kernel);
		op.filter(bi, buff);
		
		return buff;
	}

Revision: 1721
at November 9, 2006 23:54 by whitetiger


Initial Code
	public BufferedImage Embrossing(BufferedImage bi)
	{
		BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
		
		Kernel kernel = new Kernel(3, 3, new float[] {
														-2f, 0f, 0f, 
														 0f, 1f, 0f, 
														 0f, 0f, 2f
													 });
		
		ConvolveOp op = new ConvolveOp(kernel);
		op.filter(bi, buff);
		
		return buff;
	}


	public BufferedImage Blurring(BufferedImage bi)
	{
		BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
		
		Kernel kernel = new Kernel(3, 3, new float[] {
														1f/9f, 1f/9f, 1f/9f, 
														1f/9f, 1f/9f, 1f/9f, 
														1f/9f, 1f/9f, 1f/9f
													 });
		
		ConvolveOp op = new ConvolveOp(kernel);
		op.filter(bi, buff);
		
		return buff;
	}


	public BufferedImage Sharpening(BufferedImage bi)
	{
		BufferedImage buff = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
		
		Kernel kernel = new Kernel(3, 3, new float[] {
														-1f, -1f, -1f, 
														-1f,  9f, -1f, 
														-1f, -1f, -1f
													 });
		
		ConvolveOp op = new ConvolveOp(kernel);
		op.filter(bi, buff);
		
		return buff;
	}

Initial URL

                                

Initial Description

                                

Initial Title
Java - ImageFilter Simple

Initial Tags
image, java, filter, images

Initial Language
Java