Skip to content

Instantly share code, notes, and snippets.

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.swing.*;
import java.awt.GridLayout;
import java.util.Scanner;
import java.awt.Color;
import java.awt.image;
class SharpenFilter implements MyFilter {
public BufferedImage processImage(BufferedImage image) {
float[] sharpenMatrix = { 0.0f, -1.0f, 0.0f, -1.0f, 5.0f, -1.0f, 0.0f, -1.0f, 0.0f };
BufferedImageOp sharpenFilter = new ConvolveOp(new Kernel(3, 3, sharpenMatrix),
ConvolveOp.EDGE_NO_OP, null);
return sharpenFilter.filter(image, null);
}
}