freesoft_2000 9 Practically a Master Poster

Hi everyone,

                I am trying to use the kernel class to brighten and blur jpeg images but it does not seem to work although the the program compiles without any errors.

Here is the function i use to sharpen my jpeg images

public BufferedImage imagesharper(BufferedImage SourceImage2)
{
BufferedImage Image4 = null;
//i am not ver sure as to whether the calculation values for my kernel 
//are correct
float[] k1 = new float[] {
                            -1,-1,-1,
                             9,-1,-1,
                            -1,-1,-1};
Kernel Kernel1 = new Kernel(3, 3, k1);

BufferedImageOp op = new ConvolveOp(Kernel1);
Image4 = op.filter(SourceImage2, null);

return Image4;
}

Here is the function i use to blur my jpeg images

public BufferedImage imageblur(BufferedImage SourceImage5)
{
BufferedImage Image11 = null;
//i am not ver sure as to whether the calculation values for my kernel 
//are correct
float[] k2 = new float[] {
                          1f/9f, 1f/9f, 1f/9f,
                          1f/9f, 1f/9f, 1f/9f,
                          1f/9f, 1f/9f, 1f/9f};

Kernel Kernel2 = new Kernel(3, 3, k2);

BufferedImageOp op = new ConvolveOp(Kernel2);
Image11 = op.filter(SourceImage5, null);

return Image11;
}

The program compiles without any errors but when use either the above functions an array index out of bounds exception is thrown.
Could someone see if i am using the kernel class the right way and tell me what i am doing wrong.

Thank You

Yours Sincerely

Richard West

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.