Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Java - Erode

// JAI Filter erode

public RenderedImage erode(BufferedImage img)
	{
		KernelJAI kernel = new KernelJAI(7, 7, new float[]{
															0, 0, 0, 0, 0, 0, 0,
															0, 1, 1, 1, 1, 1, 0,
															0, 1, 1, 1, 1, 1, 0,
															0, 1, 1, 1, 1, 1, 0,
															0, 1, 1, 1, 1, 1, 0,
															0, 1, 1, 1, 1, 1, 0,
															0, 0, 0, 0, 0, 0, 0
															});
		ParameterBlock pb = new ParameterBlock();
		pb.addSource(img);
		pb.add(kernel);
		
		return JAI.create("erode", pb);
	}

Java - subTraction

// Use JAI filter

public RenderedImage subTraction(BufferedImage img1, BufferedImage img2)
	{
		ParameterBlock pb = new ParameterBlock();
		pb.addSource(img1);
		pb.addSource(img2);
		
		return JAI.create("subtract", pb);
	}
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS