MuhammadAdil
asked on
Sharpen Image with Java
I use this Method to sharpen an Image. But i m gotting error. ("unable to convolve src Image")
public BufferedImage changeSharpness(BufferedIm age img, int sharpen)
{
try{
for(int i=0;i<sharpen;i++){
Kernel kernel = new Kernel(3, 3,
new float[] {
-1, -1, -1,
-1, 9, -1,
-1, -1, -1});
BufferedImageOp op= new ConvolveOp(kernel);
buff = op.filter(img,null);
}
}
catch(Exception e)
{
JOptionPane.showMessageDia log(new JFrame(),e.getMessage(),"T est",0);
}
return buff;
}
public BufferedImage changeSharpness(BufferedIm
{
try{
for(int i=0;i<sharpen;i++){
Kernel kernel = new Kernel(3, 3,
new float[] {
-1, -1, -1,
-1, 9, -1,
-1, -1, -1});
BufferedImageOp op= new ConvolveOp(kernel);
buff = op.filter(img,null);
}
}
catch(Exception e)
{
JOptionPane.showMessageDia
}
return buff;
}
Maybe the image you use cannot be filtered.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The following bug report seems apt for you:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4957775
As a workaround, the recommended solution is to "Convert it to a simpler image by either creating a new BufferedImage with the same dimensions and TYPE_RGB, then getting the graphics and drawing it before convolving"
Hope that helps.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4957775
As a workaround, the recommended solution is to "Convert it to a simpler image by either creating a new BufferedImage with the same dimensions and TYPE_RGB, then getting the graphics and drawing it before convolving"
Hope that helps.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Plz tell me code for Sharpen image with JAI.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.