Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to apply a blur filter for my program?
How to apply a blur filter for my program? [message #325250] Wed, 13 February 2008 13:48 Go to next message
Eclipse UserFriend
Originally posted by: agostinacchio.gmail.com

Hi All!

I loaded a jpg image on my JScrollPane. I used:

g_image = JAI.create("fileload", g_filename);

where g_image is a PlanarImage;

I created a class named ImageClass in which I declared: BufferedImage
image2;

Then when the image is loaded I wrote:

image.image2 = g_image.getAsBufferedImage();
jScrollPane1.setViewportView(image);

and the image is shown;

Now I want to apply a filter to my image;

I declared:

public final float[] BLUR3x3 = {
0.1f, 0.1f, 0.1f, // low-pass filter kernel
0.1f, 0.2f, 0.1f,
0.1f, 0.1f, 0.1f
};

at the beginning of the file class and the method:

void Blur_actionPerformed(ActionEvent e)
{

BufferedImage imgDest= null;
float[] data = BLUR3x3;

if (g_rast != null)
{
Graphics2D l_g2 = (Graphics2D) image.getGraphics();

//image.image2.getRGB(0, 0, image.getWidth(), image.getHeight(), l, 0,
1);

imgDest = new BufferedImage
(image.image2.getWidth(),image.image2.getHeight(),
BufferedImage.TYPE_INT_RGB);




ConvolveOp cop2 = new ConvolveOp(new Kernel(3, 3, data),
ConvolveOp.EDGE_NO_OP, null );




l_g2.drawImage(imgDest , cop2, 0, 0);

image.image2 = imgDest;

image.repaint();
}


when the Blur button is pressed it runs this code but it shows a black
image!!

I think the problem is the the fact that imgDest has the type TYPE_INT_RGB
and the mask uses float number.

Can anyone help me? It's an hard problem for me becouse i am almost a
beginner.
Re: How to apply a blur filter for my program? [message #325263 is a reply to message #325250] Wed, 13 February 2008 14:38 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

This questions is not appropriate for this newsgroup ... you need to
find a java one, try google groups or yahoo groups.

PW


Previous Topic:Clearing of Workspace data
Next Topic:Cell Editors in JFace Table Viewers
Goto Forum:
  


Current Time: Fri Apr 26 03:00:58 GMT 2024

Powered by FUDForum. Page generated in 0.03573 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top