/** * Sharpens an image using a convolution matrix. * The sharpen kernel used, is defined by the following 3 by 3 matrix: * <TABLE border="1" cellspacing="0"> * <TR><TD>0.0</TD><TD>-0.3</TD><TD>0.0</TD></TR> * <TR><TD>-0.3</TD><TD>2.2</TD><TD>-0.3</TD></TR> * <TR><TD>0.0</TD><TD>-0.3</TD><TD>0.0</TD></TR> * </TABLE> * <P/> * This is the same result returned as * {@code sharpen(pOriginal, 0.3f)}. * * @param pOriginal the BufferedImage to sharpen * * @return a new BufferedImage, containing the sharpened image. */ public static BufferedImage sharpen(BufferedImage pOriginal) { return convolve(pOriginal, SHARPEN_KERNEL, EDGE_REFLECT); }
/** * Sharpens an image using a convolution matrix. * The sharpen kernel used, is defined by the following 3 by 3 matrix: * <TABLE border="1" cellspacing="0"> * <TR><TD>0.0</TD><TD>-{@code pAmount}</TD><TD>0.0</TD></TR> * <TR><TD>-{@code pAmount}</TD> * <TD>4.0 * {@code pAmount} + 1.0</TD> * <TD>-{@code pAmount}</TD></TR> * <TR><TD>0.0</TD><TD>-{@code pAmount}</TD><TD>0.0</TD></TR> * </TABLE> * * @param pOriginal the BufferedImage to sharpen * @param pAmount the amount of sharpening * * @return a BufferedImage, containing the sharpened image. */ public static BufferedImage sharpen(BufferedImage pOriginal, float pAmount) { if (pAmount == 0f) { return pOriginal; } // Create the convolution matrix float[] data = new float[] { 0.0f, -pAmount, 0.0f, -pAmount, 4f * pAmount + 1f, -pAmount, 0.0f, -pAmount, 0.0f }; // Do the filtering return convolve(pOriginal, new Kernel(3, 3, data), EDGE_REFLECT); }
/** * Sharpens an image using a convolution matrix. * The sharpen kernel used, is defined by the following 3 by 3 matrix: * <TABLE border="1" cellspacing="0"> * <TR><TD>0.0</TD><TD>-0.3</TD><TD>0.0</TD></TR> * <TR><TD>-0.3</TD><TD>2.2</TD><TD>-0.3</TD></TR> * <TR><TD>0.0</TD><TD>-0.3</TD><TD>0.0</TD></TR> * </TABLE> * <P/> * This is the same result returned as * {@code sharpen(pOriginal, 0.3f)}. * * @param pOriginal the BufferedImage to sharpen * * @return a new BufferedImage, containing the sharpened image. */ public static BufferedImage sharpen(BufferedImage pOriginal) { return convolve(pOriginal, SHARPEN_KERNEL, EDGE_REFLECT); }
/** * Sharpens an image using a convolution matrix. * The sharpen kernel used, is defined by the following 3 by 3 matrix: * <TABLE border="1" cellspacing="0"> * <TR><TD>0.0</TD><TD>-0.3</TD><TD>0.0</TD></TR> * <TR><TD>-0.3</TD><TD>2.2</TD><TD>-0.3</TD></TR> * <TR><TD>0.0</TD><TD>-0.3</TD><TD>0.0</TD></TR> * </TABLE> * <P/> * This is the same result returned as * {@code sharpen(pOriginal, 0.3f)}. * * @param pOriginal the BufferedImage to sharpen * * @return a new BufferedImage, containing the sharpened image. */ public static BufferedImage sharpen(BufferedImage pOriginal) { return convolve(pOriginal, SHARPEN_KERNEL, EDGE_REFLECT); }
/** * Sharpens an image using a convolution matrix. * The sharpen kernel used, is defined by the following 3 by 3 matrix: * <TABLE border="1" cellspacing="0"> * <TR><TD>0.0</TD><TD>-{@code pAmmount}</TD><TD>0.0</TD></TR> * <TR><TD>-{@code pAmmount}</TD> * <TD>4.0 * {@code pAmmount} + 1.0</TD> * <TD>-{@code pAmmount}</TD></TR> * <TR><TD>0.0</TD><TD>-{@code pAmmount}</TD><TD>0.0</TD></TR> * </TABLE> * * @param pOriginal the BufferedImage to sharpen * @param pAmmount the ammount of sharpening * * @return a BufferedImage, containing the sharpened image. */ public static BufferedImage sharpen(BufferedImage pOriginal, float pAmmount) { if (pAmmount == 0f) { return pOriginal; } // Create the convolution matrix float[] data = new float[] { 0.0f, -pAmmount, 0.0f, -pAmmount, 4f * pAmmount + 1f, -pAmmount, 0.0f, -pAmmount, 0.0f }; // Do the filtering return convolve(pOriginal, new Kernel(3, 3, data), EDGE_REFLECT); }
/** * Sharpens an image using a convolution matrix. * The sharpen kernel used, is defined by the following 3 by 3 matrix: * <TABLE border="1" cellspacing="0"> * <TR><TD>0.0</TD><TD>-{@code pAmount}</TD><TD>0.0</TD></TR> * <TR><TD>-{@code pAmount}</TD> * <TD>4.0 * {@code pAmount} + 1.0</TD> * <TD>-{@code pAmount}</TD></TR> * <TR><TD>0.0</TD><TD>-{@code pAmount}</TD><TD>0.0</TD></TR> * </TABLE> * * @param pOriginal the BufferedImage to sharpen * @param pAmount the amount of sharpening * * @return a BufferedImage, containing the sharpened image. */ public static BufferedImage sharpen(BufferedImage pOriginal, float pAmount) { if (pAmount == 0f) { return pOriginal; } // Create the convolution matrix float[] data = new float[] { 0.0f, -pAmount, 0.0f, -pAmount, 4f * pAmount + 1f, -pAmount, 0.0f, -pAmount, 0.0f }; // Do the filtering return convolve(pOriginal, new Kernel(3, 3, data), EDGE_REFLECT); }