-
Kernel
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks