Skip to main content

Black Lines and quality loss while using convolution and rotation operators

1 reply [Last post]
chipollino
Offline
Joined: 2010-02-20
Points: 0

Hello everyone!

I am a newbie with JAI. I am doing a project to make an Image editing program for my Programming class. I would really appreciate if you could give me a couple of tips.

For instance, how do I get rid of black lines that surround a picture when I use JAI operators for convolution (sharpening and blurring effects) and rotation. Another interesting thing is that when I rotate a picture, together with getting this black frames it also looses the quality and becomes blurred...

Listing for my Sharpen class:
package see;

import javax.media.jai.JAI;
import javax.media.jai.KernelJAI;
import javax.media.jai.RenderedOp;
import javax.swing.JOptionPane;
import com.sun.media.jai.widget.DisplayJAI;

public class Sharpen {

private RenderedOp sharpen;
private DisplayJAI main;
private Picture pic;

public Sharpen (DisplayJAI main, Picture pic){
this.main = main;
this.pic = pic;
if (main.getSource().equals(pic.Placeholder)){
JOptionPane.showMessageDialog(null, "Du har ikke åpnet et bilde.",
"Ingen bilder", JOptionPane.WARNING_MESSAGE);
new Open (main, pic);
if (main.getSource().equals(pic.Placeholder)){
JOptionPane.showMessageDialog(null, "Prøv å åpne ett nytt bilde.", "Ingen bilder", JOptionPane.WARNING_MESSAGE);
}
else
doit();
}
else
doit();
}
public void doit (){
float sharpMatrix[]={-1.0f, -1.0f, -1.0f,
-1.0f, 7.0f, -1.0f,
-1.0f, -1.0f, -1.0f,};
KernelJAI sharpKernel = new KernelJAI (3,3, sharpMatrix);
sharpen = JAI.create("convolve", main.getSource(), sharpKernel);
pic.imageCreatePicture(main, sharpen);
}

}

Message was edited by: chipollino

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chipollino
Offline
Joined: 2010-02-20
Points: 0

deleted

Message was edited by: chipollino